Some newly discovered information about listboxes containing radio buttons.
If you want to edit or create a UI listbox, and you give it a protortype row continaing a single buttons whose buttontype=radio, there are some issues in extracting data from it. For an example see levelup_animalx2.xml as shown below:
[nwscript]
<UIListbox name="COMPANION_LIST" x="30" y=70 width=229 height=550 xPadding="0" yPadding="5"
showpartialchild="true" scrollbaronright="true" unequalcontrols="true" scrollsegmentsize="10"
hidescrollbarwhennotneeded="true" hideoverride=true update="true" OnUpdate=UIListBox_OnUpdate_CreateFamiliarList("LEVELUP","ANIMAL_COMPANION","INFOPANE_TEXT") >
<UIButton name="COMPANION_BUTTON" x=0 y=0 width=210 height=40 buttontype=radio groupid=1 prototype=true
OnLeftClick0=UIObject_Misc_StoreObjectData(local:100)
OnLeftClick1=UIObject_Misc_ExecuteServerScript("gui_elu_selectcompanion",local:100,0) >
[/nwscript]
In the above, I have added the two leftclick callbacks, because I have during the OnAdd for this scenes manipulated the listbox rows via the scriptfunction ModifyListBoxRow in order to set some unique variables on it so that I would know which row was selected by the user. The normal means of getting at this data is via
OnLeftClick0=UIObject_Misc_ExtractData("selected:listboxname","string",0,local:100)
Well it turns out, that for radio buttons the above ExtraData function does not work and will return no values for any data type (int, string, float, etc) Nor will the other lookup variables work (listboxtext:listboxname.textfieldname, or listboxrow:listboxname)
However the one function that does work is the one I have in the code above:
UIObject_Misc_StoreObjectData
For this, the only variable value you can retrieve is what was stored at index 0 as a string. So if you need multiple values, you'll have to either only store a reference , which on your execute cvallback you can use to look up a larger set of values, or embeed all the values ito the string varable value via a concatenated string that you must parse.
I discovered this little quick while figuring out how to manipulate the levelup screens for animal companions and familiars in order to expand and filter the choices lists and provide support for feats like Improved Familiar and so on.
Bearbeitet von 0100010, 26 Dezember 2010 - 02:35 .