scripting:dialogs:listbox

List Box

List box example List box control with ability to select single item by index.

Property Default Value Description
id empty id (name) of the script data object associated with control
align stretched 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

Combo Box is filled by Items, defining value set for selection.

Property Default Value Description
text empty Item text
For dynamic item list one can use dynamic creation of the dialog XML. See example for multi selection listbox.
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="&amp;OK" default="true" returnval="ok"/> \
   		<button title="&amp;Cancel" returnval="cancel"/> \
   	</group> \
</dialog>@';
 
Output().writeln("Dialog 4 returns: " + dialog(dialog_template, varStorage));
Output().writeln("By Index selection: " + varStorage.byIndex);