PDA

View Full Version : Drop down menu



Visvalor
December 1st, 2009, 02:04
Doing a custom ruleset and need a drop down menu for selecting race that will then change the basic stats of the character :P

Anyone have any idea how to make a drop-down menu in FG?

Foen
December 1st, 2009, 05:48
There is no exact method for replicating drop-down functionality, because it isn't possible to determine if a control (other than a text control) has lost the focus. A similar effect can be achieved using a windowlist control that floats near the target field and is either visible or invisible depending on whether the user has clicked on a trigger.

The Pathfinder ruleset makes good use of this feature, so hopefully you shouldn't have to wait long before you can see it in action.

Foen

Visvalor
December 1st, 2009, 05:50
I thought about using a radio button style click thing as I saw those were supported :p but I have 26 races.

So you are saying I should look into Pathfinder and see how they did it?

Foen
December 1st, 2009, 05:52
I'm not sure if the Pathfinder code can be freely re-used, but the concept can be seen in action - not least you can see if that is the kind of thing you are after.

Visvalor
December 1st, 2009, 05:56
That is true =D I'll go have a look see in a bit thanks.

Other then them however any idea how to make a selection out of 26 options without taking too much space :P?

Foen
December 1st, 2009, 06:45
You could use a scrollable list (like the one in the FG launcher, where you select the campaign), or allow freeform data entry with validation/autocomplete (like the NPC skill list).

Visvalor
December 1st, 2009, 07:21
You could use a scrollable list (like the one in the FG launcher, where you select the campaign), or allow freeform data entry with validation/autocomplete (like the NPC skill list).

THAT would definitely work :P

Problem is I'm still rather new ^^ any idea where to go to find out how exactly to do this?

joshuha
December 1st, 2009, 12:12
I created a template for a drop down like control, let me see if I can dig it up today. It needed some small tweaks but worked for the most part.

joshuha
December 1st, 2009, 22:04
So this is all very crude and I never got around to refining it but basically my "dropdown" simulates putting a new window on right below the current string control. Like Foen noted though this has some issue if you click off the window entirely getting focus back can get tricky.

You will also notice in my LUA file I was trying some math to get the alignment of text right in the dropdown and that may need some more fiddling with as well but its a start. Also it uses some math to determine where in the dropdown you clicked.



Template definition



<template name="dropdown">
<windowlist>
<bounds>0,0,1,1</bounds>
<frame>
<name>modifier</name>
<offset>10,5,5,5</offset>
</frame>
<noscroll />
<skipempty />
<class>string_only</class>
<script file="scripts/dropdown.lua"></script>
</windowlist>
</template>



dropdown.lua file


list = {};
state = "non-init";
field = "";

function getState()
return state;
end

function setState(newstate)
state = newstate;
end

function onClickDown(button,x,y)
itemnum = math.floor(y/15+1);
if itemnum >= 1 and itemnum <= table.maxn(list) then
window[field].setValue(list[itemnum]);
end
setState("off");
setVisible(false);
return true;
end

function createDropdown(x,y,infield,inlist)
listcount = table.maxn(inlist);
field = infield;
--assume 20 pixel height
--100 baseline width
basew,w = 100,100;
h = listcount * 15;
setStaticBounds(x,y,w,h);

for i=1, listcount do

list[i] = inlist[i];
if string.len(inlist[i])*5 > basew then
w = string.len(inlist[i])*5;
end
local newentry = createWindow();
newentry.text.setValue(inlist[i]);
newentry.text.setReadOnly(true);
end

if w > basew then
setStaticBounds(x,y,w,h);
end
end



Example of use:


<stringcontrol name="sc_font">
<bounds>223,43,100,20</bounds>
<font>sheetlabelsmall</font>
<frame>
<name>modifier</name>
<offset>10,5,5,0</offset>
</frame>
<static>sheetlabel</static>
</stringcontrol>

<genericcontrol name="sc_font_button">
<bounds>323,43,20,20</bounds>
<icon>button_ctnextactor</icon>
<script>
function onClickDown(button, x, y)
if window.sc_font_dropdown.getState() == "off" then
window.sc_font_dropdown.setState("on");
window.sc_font_dropdown.setVisible(true);
elseif window.sc_font_dropdown.getState() == "on" then
window.sc_font_dropdown.setState("off");
window.sc_font_dropdown.setVisible(false);
elseif window.sc_font_dropdown.getState() == "non-init" then
window.sc_font_dropdown.createDropdown(223,60,"sc_font",{"sheetlabel","sheettext", "sheettextsmall"});
window.sc_font_dropdown.setState("on");
window.sc_font_dropdown.setVisible(true);
end
end
</script>
</genericcontrol>

<dropdown name="sc_font_dropdown" >
<invisible />
</dropdown>

Visvalor
December 1st, 2009, 22:06
It's appreciated ^^ I'll tell you what's what soon as I install it.

Visvalor
December 2nd, 2009, 00:43
I get this;

Script Error:[string"charsheet_main:sc_font_button]1:attempt to index field 'sc_font_drowndown'(a nil value)

What am I doing wrong :P?

ddavison
December 2nd, 2009, 04:29
I was going to wait for the Pathfinder ruleset to release fully before exposing this functionality, but since I don't know exactly how long it will take to get approval from Paizo... we might as well release it now. We can list two versions, the alpha version which works very well but requires a lot more scripting and then the streamlined version that Foen helped refine (assuming he is okay with sharing it.) I'll just post the alpha version here.

Sample video showing it in action:
Video 1 (www.fantasygrounds.com/images/screenshots/Fantasy_Grounds_Pathfinder_Vid1.wmv)
Video 2 (www.fantasygrounds.com/images/screenshots/Fantasy_Grounds_Pathfinder_Vid1.wmv)

ddavison
December 2nd, 2009, 04:34
Post 1 of 4

Summary:
1. Add a dropdown icon to the string control you want to use. (In truth it should also work for numeric controls.)
2. When the dropdown icon is clicked, display a previously invisible windowlist control inside a frame that looks like a dropdown.
3. The windowlist is filled with dropdownlistitems which bubble a click event to pass the value to the target control and then re-hide the windowlist
4. Provide other cool features like auto-complete if the user chooses to type in their values. ** Don't force a selection from the list

Add to common_templates.xml or a new file linked to your ruleset's base.xml


<template name="dropdowntrigger">
<genericcontrol>
<icon>button_dropdown</icon>
<anchored>
<position>right</position>
<offset>-20</offset>
</anchored>
<script>
function onClickDown(button, x, y)
if button == 1 then
setVisible(false);
window[target[1]].setVisible(true);
window[target[1].."Frame"].setVisible(true);
elseif button == 2 then
window[target[1]].setValue("");
end
end

function onInit()
window[target[1]].setVisible(false);

if anchor then
setAnchor("top", anchor[1], "top", "absolute", 0);
setAnchor("bottom", anchor[1], "bottom", "absolute", 0);
setAnchor("left", anchor[1], "right", "absolute", -20);
setAnchor("right", anchor[1], "right", "absolute", 0);
end

setVisible(true);
end
</script>
</genericcontrol>
</template>

<windowclass name="dropdownListItem">
<nodelete/>
<sizelimits>
<minimum>
<height>10</height>
</minimum>
</sizelimits>
<sheetdata>
<dropdownlistitemvalue name="name">
<anchored>
<left>
<anchor>left</anchor>
</left>
<right>
<anchor>right</anchor>
</right>
<top>
<anchor>top</anchor>
</top>
</anchored>
</dropdownlistitemvalue>
</sheetdata>
<script>
function onHover(oncontrol)
window.setFrame("rowshade");

if hasFocus() or dragging then
return;
end

--[[ Reset selection when the cursor leaves the control]]
if not oncontrol then
window.setFrame(nil);

setCursorPosition(0);
end
end

function onHoverUpdate(x, y)
hoverx, hovery = x, y;

if hasFocus() or dragging then
return;
end

--[[ Hilight listitem hovered on]]
window.setFrame("rowshade");
setHoverCursor("hand");

return;
end

</script>
</windowclass>

<template name="dropdownlistitemvalue">
<stringcontrol name="value">
<offset>20,0</offset>
<font>sheetlabelsmall</font>
<static></static>
<multilinespacing>20</multilinespacing>
<frame>
<name>textline</name>
</frame>
<script>
function onHover(oncontrol)
window.setFrame("rowshade");

if hasFocus() or dragging then
return;
end

--[[ Reset selection when the cursor leaves the control]]
if not oncontrol then
window.setFrame(nil);

setCursorPosition(0);
end
end

function onHoverUpdate(x, y)
hoverx, hovery = x, y;

if hasFocus() or dragging then
return;
end

--[[ Hilight listitem hovered on]]
window.setFrame("rowshade");
setHoverCursor("hand");

return;
end

function onClickDown(button, x, y)
window.windowlist.window[window.windowlist.target[1]].setValue(getValue());
end

</script>
</stringcontrol>
</template>

ddavison
December 2nd, 2009, 04:35
Post 2 of 4

Add a script file for template_dropdown.lua


-- This file is part of the Fantasy Grounds Open Foundation Ruleset project.
-- For the latest information, see https://www.fantasygrounds.com/
--
-- Copyright 2008 SmiteWorks Ltd.
--
-- This file is provided under the Open Game License version 1.0a
-- Refer to the license.html file for the full license text
--
-- All producers of work derived from this material are advised to
-- familiarize themselves with the license, and to take special
-- care in providing the definition of Product Identity (as specified
-- by the OGL) in their products.
--
-- All material submitted to the Open Foundation Ruleset project must
-- contain this notice in a manner applicable to the source file type.


-- This allows the applySort() feature of the windowlist to function
-- properly. An empty value will sort to the top with this method. To
-- reverse, make the first conditional true and the second false.
function onSortCompare(w1, w2)
if w1.name.getValue() == "" then
return false;
elseif w2.name.getValue() == "" then
return true;
end

return w1.name.getValue() > w2.name.getValue();
end

-- Show the trigger button (the little dropdown indicator) again and
-- hide the current windowlist and the containing frame for the dropdown
-- whenever a value is selected.
function onClickDown(button, x, y)
if button == 1 then
setVisible(false);
window[trigger[1]].setVisible(true);
window[container[1]].setVisible(false);
elseif button == 2 then
window[target[1]].setValue("");
end
end

function onInit()
setVisible(false);

-- anchor the dropdownlist to the dropdownlist frame control
if anchorframe then
setAnchor("top", anchorframe[1], "top", "absolute", 10);
setAnchor("bottom", anchorframe[1], "bottom", "absolute", -15);
setAnchor("left", anchorframe[1], "left", "absolute", 20);
setAnchor("right", anchorframe[1], "right", "absolute", -20);
end

-- Check for the existance of the first lookup table setting. If it exists,
-- iterate throught he list and add them to the dropdown windowlist
if lookup and lookup[1] then
for _key, _value in pairs(Lookups[lookup[1]]) do
li = createWindow("dropdownlistitemvalue");

-- Check for a lookup field name and use that if set. Otherwise, this
-- is a flat table of values. If any lookup field names are supplied,
-- then one should be provided for all of them; although, the values can
-- be blank. Blank values will be treated the same as NIL values.
if lookupFieldName and lookupFieldName[1]~="" then
li.name.setValue(_value[lookupFieldName[1]]);
else
li.name.setValue(_value);
end
end
end


-- Check for the existance of the second lookup table setting. If it exists,
-- iterate throught he list and append them to the dropdown windowlist.
if lookup and lookup[2] then
for _key, _value in pairs(Lookups[lookup[2]]) do
li = createWindow("dropdownlistitemvalue");


-- Check for a lookup field name and use that if set. Otherwise, this
-- is a flat table of values. If any lookup field names are supplied,
-- then one should be provided for all of them; although, the values can
-- be blank. Blank values will be treated the same as NIL values.
if lookupFieldName and lookupFieldName[2]~="" then
li.name.setValue(_value[lookupFieldName[2]]);
else
li.name.setValue(_value);
end
end
end

-- Check for the existance of the first lookup table setting. If it exists,
-- iterate throught he list and add them to the dropdown windowlist
if lookup and lookup[3] then
for _key, _value in pairs(Lookups[lookup[3]]) do
li = createWindow("dropdownlistitemvalue");


-- Check for a lookup field name and use that if set. Otherwise, this
-- is a flat table of values. If any lookup field names are supplied,
-- then one should be provided for all of them; although, the values can
-- be blank. Blank values will be treated the same as NIL values.
if lookupFieldName and lookupFieldName[3]~="" then
li.name.setValue(_value[lookupFieldName[3]]);
else
li.name.setValue(_value);
end
end
end

-- Sort the results
applySort();
end

ddavison
December 2nd, 2009, 04:39
Post 3 of 4

I also preferred to place a common list of all lookups used throughout the ruleset, so I create a global_lookups.lua script file


--
-- This file is part of the Fantasy Grounds Open Foundation Ruleset project.
-- For the latest information, see https://www.fantasygrounds.com/
--
-- Copyright 2008 SmiteWorks Ltd.
--
-- This file is provided under the Open Game License version 1.0a
-- Refer to the license.html file for the full license text
--
-- All producers of work derived from this material are advised to
-- familiarize themselves with the license, and to take special
-- care in providing the definition of Product Identity (as specified
-- by the OGL) in their products.
--
-- All material submitted to the Open Foundation Ruleset project must
-- contain this notice in a manner applicable to the source file type.

function onInit()
defineLookups();
end

function defineLookups()
-- These are global table values usable in any script
movementModes = {"walk","climb","burrow","fly","swim"};
races = {"Dwarf","Halfling","Elf","Human","Gnome","Half-orc","Half-elf"};
monsterRaces = {"Elan","Kobold","Maenad","Orc","Xeph","Dromite","Half-Giant","Hobgoblin","Satyr","Azer","Centaur","Ogre","Half-Ogre","Sprite","Doppleganger","Minotaur","Gargoyle","Hound Archon","Troll","Jann","Scrag","Ogre Mage","Rakshasa","Hill Giant","Stone Giant","Gnoll","Drow","Lizardfolk","Grimlock","Deep Gnome","Bugbear","Aasimar","Tiefling","Duergar","Aquatic Elf","Gray Elf","High Elf","Wild Elf","Wood Elf","Forest Gnome","Rock Gnome","Goblin","Deep Halfling","Lightfoot Halfling","Tallfellow Halfling"}
abilityScores = {
{Name="Strength",Abbreviation="Str"},
{Name="Dexterity",Abbreviation="Dex"},
{Name="Constitution",Abbreviation="Con"},
{Name="Intelligence",Abbreviation="Int"},
{Name="Wisdom",Abbreviation="Wis"},
{Name="Charisma",Abbreviation="Cha"}};
saves = {
{Name="Fortitude",Abbreviation="Fort"},
{Name="Reflex",Abbreviation="Ref"},
{Name="Willpower",Abbreviation="Will"}};
alignments = {
{Name="Lawful Evil",Abbreviation="LE"},
{Name="Neutral Evil",Abbreviation="NE"},
{Name="Chaotic Evil",Abbreviation="CE"},
{Name="Lawful Neutral",Abbreviation="LN"},
{Name="Neutral",Abbreviation="N"},
{Name="Chaotic Neutral",Abbreviation="CN"},
{Name="Lawful Good",Abbreviation="LG"},
{Name="Neutral Good",Abbreviation="NG"},
{Name="Chaotic Good",Abbreviation="CG"}};
abilityTypes = {
{Name="Extraordinary Abilities", Abbreviation="Ex"},
{Name="Spell-like Abilities", Abbreviation="Sp"},
{Name="Supernatural Abilities",Abbreviation="Su"}};
sizes = {
F = {Name="Fine",Abbreviation="F",ACModifier=8},
D = {Name="Diminutive",Abbreviation="D",ACModifier=4},
T = {Name="Tiny",Abbreviation="T",ACModifier=2},
S = {Name="Small",Abbreviation="S",ACModifier=1},
M = {Name="Medium",Abbreviation="M",ACModifier=0},
L = {Name="Large",Abbreviation="L",ACModifier=-1},
H = {Name="Huge",Abbreviation="H",ACModifier=-2},
G = {Name="Gargantuan",Abbreviation="G",ACModifier=-4},
C = {Name="Colossal",Abbreviation="C",ACModifier=-8}
};
skillTraining = {"Untrained","Trained","Trained Class Skill"};
featTypes = {"Combat","Critical","Item Creation","Metamagic"};
coinNames = {"Copper piece(s)","Silver piece(s)","Gold piece(s)","Platinum piece(s)"};
coinAbbreviations = {"cp","sp","gp","pp"};
weaponRangeType = {"melee","ranged"};
weaponHands = {"light","one-handed","two-handed"};
weaponTrainingType = {"Simple","Martial","Exotic","Siege Weapon","Special","Ammo"};
weaponSize = {"fine","diminutive","tiny","small","medium","large","huge","gargantuan","colossal"};
weaponDamageType = {
bludgeoning = {Name="bludgeoning",Abbreviation="B"},
piercing = {Name="piercing",Abbreviation="P"},
slashing = {Name="slashing",Abbreviation="S"}
};
armorType = {"Light Armor","Medium Armor","Heavy Armor","Shield","Extras"};
actionTypes = {"Standard","Full-Round","Move","Free","Swift","Immediate","Not an Action","Restricted"};
actionTypeList = {
Standard={"Standard action","Attack (melee)","Attack (ranged)","Attack (unarmed)","Activate a magic item other than a potion or oil","Aid another","Cast a spell","Channel Energy","Concentrate to maintain an active spell","Dismiss a spell","Draw a hidden weapon","Drink a potion","Apply an Oil","Escape a grapple","Feint","Light a torch with a tindertwig","Lower spell resistance","Read a scroll","Ready (triggers a standard action)","Stabilize a dying friend","Total defense","Use extraordinary ability","Use skill that takes 1 action","Use spell-like ability","Use supernatural ability"},
FullRound={"Full-round action","Full Attack","Charge","Deliver a coup de grace","Escape from a net","Extinguish flames","Light a torch","Load a heavy or repeating crossbow","Lock or unlock weapon in locked guantlet","Prepare to throw splash weapon","Run","Use skill that takes 1 round","Use a touch spell on up to six friends","Withdraw"},
Move={"Move action","Move","Control a frightened mount","Direct or redirect an active spell","Draw a weapon","Load a hand crossbow or light crossbow","Open or close a door","Mount/Dismount a steed","Move a heavy object","Pick up an item","Sheathe a weapon","Stand up from prone","Ready or drop a shield","Retrieve a stored item"},
Free={"Free action","Cease concentration on a spell","Drop an item","Drop to the floor","Prepare spell components to cast a spell","Speak"},
Swift={"Swift action","Cast a quickened spell"},
Immediate={"Immediate action","Cast feather fall"},
NotanAction={"Delay","5-foot step"}
};
spellComponentNames = {"Verbal","Somatic","Material","Focus","Divine Focus"};
spellComponentAbbreviations = {"V","S","M","F","DF"};
spellRange = {"Personal","Touch","Close","Medium","Long","Unlimited","Other"};
spellRangeDetails = {"affects only caster","affects creature touched","25ft. + 5ft./lvl","100ft. + 10ft./level","400ft. + 40ft./lvl","anywhere","other"};
spellTypes = {"Divine","Arcane","Spell-like Ability","Supernatural Ability","Extraordinary Ability","Natural Ability"};
spellWizardSchools = {"Abjuration","Conjuration","Divination","Enchantment","Evocation","Illusion","Necromancy","Transmutation","Universal"};
spellSavingThrows = {"None","Ref Half","Fort Half","Will Half","Ref Negates","Fort Negates","Will Negates","See Text","Will Partial"}
spellDomains = {"Air","Animal","Artifice","Chaos","Charm","Community","Darkness","Death","Destruction","Earth","Evil","Fire","Glory","Good","Healing","Knowledge","Law","Liberation","Luck","Madness","Magic","Nobility","Plant","Protection","Repose","Rune","Strength","Sun","Travel","Trickery","War","Water","Weather"}
spellDurations = {"permanent (D)","instantaneous","1 min./level","1 min./level (D)","1 round/level (D)","1 round/level","1 hour/level","1 hour/level (D)","1 day/level","1 day/level (D)", "10 min./level", "10 min./level (D)","permanent","concentration, up to 1 round/level (D)","See text","24 hours"}
spellSecondary = {"good","evil","calling","creation","summoning","teleportation","compulsion","healing","evil","scrying","charm","compulsion","figment","glamer","pattern","phantasm","shadow","polymorph","acid","air","chaotic","cold","darkness","death","earth","electricity","fear","fire","force","language-dependent","lawful","light","mind-affecting","sonic","water"}
inventorySlots = {"armor","shield","ring","none","neck","belt","feet","wrists","shoulders","head","eyes","hands","headband","chest","body","pack","stored"};
conditions = {"Blinded","Broken","Confused","Cowering","Dazed","Dazzled","Dead","Deafened","Disabled","Dying","Energy Drained","Entangled","Exhausted","Fascinated","Fatigued","Flat-footed","Frightened","Grappled","Helpless","Incorporeal","Invisible","Nauseated","Panicked","Paralyzed","Petrified","Pinned","Prone","Shaken","Sickened","Stable","Staggered","Stunned","Unconscious"};
spellResistances = {"No","Yes","Yes (harmless)"}
YesNo = {"No","Yes"}
gender = {"Male","Female","Other"}

end

ddavison
December 2nd, 2009, 04:44
Post 4 of 4




<labeledstring name="race">
<anchored>
<to>overviewframe</to>
<position>insidetopleft</position>
<offset>275,10</offset>
<size>
<width>125</width>
<height>20</height>
</size>
</anchored>
<label>race</label>
<tabtarget>
<next>gender</next>
<prev>name</prev>
</tabtarget>
<lookup>races</lookup>
<script file="scripts/lookuphandler.lua" />
</labeledstring>
<dropdowntrigger name="ddtRace">
<icon>button_dropdown</icon>
<anchored>
<to>overviewframe</to>
<position>insidetopleft</position>
<offset>380,10</offset>
<size>
<width>20</width>
<height>20</height>
</size>
</anchored>
<target>ddlRace</target>
</dropdowntrigger>


... and the dropdown list definition with individual dropdownlistitem values. The ddl has a <target> element which references the original control where the selected value will be written. The nice thing is that it is really more of a combo box. It doesn't restrict answers to only those in the list. If you want to play a new custom house-rule race you just need to type it in. In my example, I also add a lookuphandler to the race field that allows the typed in entry to auto-complete as well.



<!-- Race Dropdowns -->
<genericcontrol name="ddlRaceFrame">
<anchored>
<to>overviewframe</to>
<position>insidetopleft</position>
<offset>275,30</offset>
<size>
<width>125</width>
<height>120</height>
</size>
</anchored>
<frame>
<name>referencebox</name>
</frame>
<script>
function onInit()
setVisible(false);
end

function onClickDown(button, x, y)
setVisible(false);
end
</script>
</genericcontrol>
<windowlist name="ddlRace">
<class>dropdownListItem</class>
<datasource></datasource>
<nodrag/>
<nodrop/>
<anchored>
<to>ddlRaceFrame</to>
<position>over</position>
<left>
<parent>ddlRaceFrame</parent>
<offset>20</offset>
</left>
<top>
<parent>ddlRaceFrame</parent>
<offset>10</offset>
</top>
<bottom>
<parent>ddlRaceFrame</parent>
<offset>-15</offset>
</bottom>
</anchored>
<lookup>races</lookup>
<lookup>monsterRaces</lookup>
<target>race</target>
<container>ddlRaceFrame</container>
<trigger>ddtRace</trigger>
<script file="scripts/template_dropdown.lua" />
</windowlist>
<scrollercontrol name="ddlRace_scroller">
<bounds>-79,-50,45,27</bounds>
<target>ddlRace</target>
<button>
<normal>button_scroller</normal>
<pressed>button_scroller_down</pressed>
</button>
<invisible />
</scrollercontrol>


add this to base.xml


<script name="Lookups" file="scripts/global_lookups.lua" />


add this to graphics.xml and supply an appropriate image


<icon name="button_dropdown" file="icons/button_dropdown.png" />



Note that with this version there is a lot of manual placement of the dropdownlist, the width of the controls, the triggers, etc. The race one was the first proof of concept one and I didn't go back and adjust it after the fact to reflect an easier placement.

Foen improved this all by adding a few more functions and putting it all into a nice and neat template.

Visvalor
December 2nd, 2009, 07:10
I put everything in correctly I believe :\ but it doesn't show up. No errors though so now I'm confused...

<script name="Lookups" file="scripts/global_lookups.lua" />

is in the base.xml does the other one need to be there too?

Visvalor
December 2nd, 2009, 07:56
Also one of your scripts references lookuphandler.lua :\ I must have overlooked that.

Eh nvm that :p replaced lookuphandler with global_lookup.lua and it works fine ;D woot thx!

Foen
December 2nd, 2009, 10:00
As Doug mentioned, there is a revised drop-down template in the pipeline (I think it will be in the Pathfinder and BRP rulesets), which I also hope to include in the FGBase ruleset. The attached images show the drop-down before it is activated, the activated drop-down and the auto-complete functionality for a trivial case (character gender).

The following sample code shows how this revised version can be included more simply in the windowclass definition. It still requires the global lookup script to define the list contents.



<labeledstring name="gender">
<anchored>
<to>overviewframe</to>
<position>insidetopleft</position>
<offset>15,32</offset>
<size>
<width>60</width>
<height>18</height>
</size>
</anchored>
<label>gender</label>
<tabtarget>
<next>age</next>
<prev>race</prev>
</tabtarget>
<lookup>Gender</lookup>
<script file="scripts/lookuphandler.lua"/>
</labeledstring>
<DropDown name="genderdropdown">
<target>gender</target>
<position>0,4</position>
<lookup>Gender</lookup>
</DropDown>


Cheers

Foen

drahkar
December 2nd, 2009, 14:15
Is that revised implementation included right now or still being developed? Based on how Doug worded it I thought it was still being developed.

Foen
December 2nd, 2009, 14:31
It is already included in version 0.6 of the Base Ruleset (https://oberoten.dyndns.org/fgwiki/index.php/Base_Ruleset) from the FG Wiki, but the other rulesets haven't been released yet.

Foen

joshuha
December 2nd, 2009, 16:24
I get this;

Script Error:[string"charsheet_main:sc_font_button]1:attempt to index field 'sc_font_drowndown'(a nil value)

What am I doing wrong :P?

If you are still using my attempt (which is not as refined as the other template given by Foen) are you sure that's the exact error message cause sc_font_drowndown isn't in my example anywhere?

Visvalor
December 2nd, 2009, 21:10
Not using yours anymore so not sure what the error says heh :p

Visvalor
December 3rd, 2009, 19:03
Works great, but now I've got a bit of an issue with the reference frame being transparent, I figured it was a resizing issue since the reference frame was a bit large so I made a new frame at 125/120 to fit it better but still having issues with transparency (Being able to see the strings behind it) any idea?