OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: ModestNovice on 25 May 2008, 00:27:40
-
Hello. I have 3 dialogs with listboxes. But I am having trouble figuring out how I can find out what was selected in the list when my button is pressed. Any help? :dunno:
-
Use onLBSelChanged UI Event handler.
Inside your list box definition in description.ext add
onLBSelChanged = "res = _this execVM ""item_selected.sqf""";
_this inside item_selected.sqf has the control (the listbox) in (_this select 0) and the selected item index (_this select 1)
-
Thanks! Exactly what I needed :good:
So how could I have it do something different for each selection.
I have the selections set through like lbsetData or sumthin. I know I have it execute a script, will it automatically? as for I have set the classname of the vehicle in the selection. like Skoda and car_sedan. Just using the select 0? will it detect what to create?
-
You need to discriminate what to do inside the function or script executed by the onLBSelChanged handler. You will get as parameter the index of the selected item so you can get its text and/or data and then decide what to do with it withing that script or function.
-
Okay thanks
How do I do a variable in a ctrlsetText
like:
ctrlSetText [103, "DCV_Bank"];
I am trying to make my balance show on the dialog
-
If you mean to show the content of a variable, convert it to string with format command.
ctrlSetText [103, format["%1", DCV_Bank]];
-
ahhh ok. I thought it would be something like a formatted thing. Only, what do I use this in? A static text I'm assuming?
Thanks for the help Mandoble.
Also, sweeeeett fountain script. I have been waiting for a script like this so I can do somewhat of a firefighting job. only thing is I don't know exactly how I could do burning buildings, maybe particles, or create a destroyed object inside and make it look like it's burning? I don't know.