scripting:dialogs:multi_listbox

This is an old revision of the document!


Multi Selection List Box

List box control with ability to select several items.

Property Default Value Description
id empty id (name) of the script data object associated with control
align empty Alignment of the control
required false required property of the control (if control is initial, “positive” buttons will be disabled)
minwidth 12 Minimum width, in characters of the list box control
extended_sel false Extended Selection mode

List Box is filled by Items. You can fill it as statically in-line, as dynamically using associated by id script variable (VB Array of integers, use ax2js function to convert from JS array).

Property Default Value Description
text empty Item text
selected false Item selected state
multi-list-box.hejs
#include "he_utils.js"	// this is include file
 
// dynamically mark as selected first and third items 
// (function js2ax as ax2js defined in he_utils.js)
var multi_listboxindex = js2ax(new Array(0,2));
 
var dialog_template =
'@<dialog title="Test dialog" resizable="true" contexthelp="true" id="testdlg"> \
	<multi_listbox extended_sel="true" id="multi_listboxindex" required="true"> \
		 <item text="Item 1"/> \
		 <item text="Item 2"/> \
		 <item text="Item 3"/> \
		 <item text="Item 4" selected="true"/> \
		 <item text="Item 5"/> \
		 <item text="Item 6"/> \
		 <item text="Item 7" selected="true"/> \
		 <item text="Item 8"/> \
		 <item text="Item 9" selected="true"/> \
		 <item text="Item 10"/> \
	</multi_listbox> \
   <group uniform="true" align="right"> \
	   <button title="&amp;OK" returnval="ok" default="true"/> \
	   <button title="&amp;Cancel" returnval="cancel"/> \
   </group> \
</dialog>@';
 
// show dialog using dialog template and variables storage for passing initial data
var returnCode = dialog(dialog_template, varStorage);
 
// evaluate here returnCode (returnval of selected button) and decide if varStorage shall be evaluated
 
// after closing of the dialog variable storage (varStorage) contains all states 
// of the controls (which has variable id connected)
 
Output().clear();
Output().writeln("Dialog returns: " + returnCode);
 
// convert VB array to JS array and output it
Output().writeln("Variable multi_listboxindex: " + ax2js(multi_listboxindex));