Show pageOld revisionsBacklinksAdd to bookBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== List Box ====== {{ :scripting:dialogs:listbox.png|List box example}} List box control with ability to select single item by index. ===== Properties ===== ^ Property ^ Default Value ^ Description ^ | **id** | empty | id (name) of the script data object associated with control | | **align** | stretched | [[scripting:dialogs:align|Alignment]] of the control | | **selected_index** | -1 | Index of selected item. Indicates fixed list. | | **required** | false | required property of the control (if control is initial, "positive" buttons will be disabled) | | **minwidth** | 0 | Minimum width, in characters of the list box control | ===== Items ===== Combo Box is filled by //Items//, defining value set for selection. ==== Item ==== ^ Property ^ Default Value ^ Description ^ | **text** | empty | Item text | <note tip>For dynamic item list one can use dynamic creation of the dialog XML. See example for [[scripting:dialogs:multi_listbox|multi selection listbox]].</note> ===== Example ===== <file javascript listbox.hejs> var varStorage = new Storage(); var dialog_template = '@<dialog title="Test Dialog" resizing="both"> \ <paragraph text="Select by Index:" style="required" minwidth="15"/> \ <listbox id="byIndex" selected_index="2" minwidth="25" required="true"> \ <item text="Very Small"/> \ <item text="Small"/> \ <item text="Normal"/> \ <item text="Large"/> \ <item text="Very Large"/> \ </listbox> \ <spacer/> \ <group minwidth="75" minheight="23" uniform="true" align="right"> \ <button title="&OK" default="true" returnval="ok"/> \ <button title="&Cancel" returnval="cancel"/> \ </group> \ </dialog>@'; Output().writeln("Dialog 4 returns: " + dialog(dialog_template, varStorage)); Output().writeln("By Index selection: " + varStorage.byIndex); </file>