OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: MorMel on 21 May 2003, 11:53:55
-
I'm a beginner to dialogs, so there are much things I'll take a long time to understand.
This is one:
How to call an action through a button from a listbox? I know how to set text (related with the listbox data) through that button, but I don't know how to execute a code (with that button) that is connected to each string of the listbox.
For example, I've a listbox with "Artillery" and "Air", in a dialog called "Support Request". If I choose "Air" (listbox) and press "CALL" (the button) i want the "Air" defined data to be executed.
-
Hey Mormel...
What you're looking for is the lbcursel command.
From the comref:
lbCurSel idc
Operand types:
idc: Number
Compatibility:
Version 1.5 required.
Type of returned value:
Number
Description:
Return index of selected item of listbox or combobox with id idc of topmost user dialog.
Example:
_index = lbCurSel 101
So all the options you've added to the listbox will have an idc... eg 0 for "Artillery", and 1 for "Air" (most probably). So when the button "Call support" is pushed, you should detect what the listbox has displayed by using the lbCurSel command ;)
Hope that helps you navigate the murky world of dialog making ;D
-
Thanks Sui.
Now, lets navigate the 'murky' world of dialogs... ;)
Bye.