Contents Previous Next Subchapters

Using A Multi-Selection List In A Dialog Window
See Also listbox

Dialog "multilist" controls are used to display a list from which the user can make one or more selections. These controls behave identical to listbox controls with the exception that more than one item may be selected.

captiongeometry, "multilist", list)
captiongeometry, "multilist", listcall back)
Adds a "multilist" control, with the specified geometry , to the window specified by caption . The geometry specifies the size of the multi-selection list. The character matrix list specifies the choices in the list. The command specified by call back is executed whenever the current selection in the list is changed by the user. The return value is the control handle for the multilist selection box.

Returns the current section in the "multilist" control specified by handle, where handle is the value returned by addcontrol when the "multilist" control was created. The return value is a logical column vector with the same row dimension as list in the corresponding call to addcontrol.

Changes the list of choices in the "multilist" control specified by handle to the list specified by list, where handle is the value returned by addcontrol when the "multilist" control was created and list is a character matrix. The return value of setcontrol is true, if the control can be set as requested, and false otherwise.

The following program creates a dialog window with a push button labeled "Print" and a "multilist" control. When the button is pressed, the value corresponding to the "multilist" control is transposed and printed in the Command window.

caption  = "Multi List Box Example"
geometry = [100, 100, 250, 200]
callback = "delwin(caption);"
adddialog(caption, geometry, callback);
geometry = [10, 10, 140, 100]
list     = {"One", "Two", "Three"}
Handle   = addcontrol(caption, geometry, "multilist", list )
geometry = [35, 145, 90, 20]
name     = "Print"
callback = "Print"
addcontrol(caption, geometry, "pushbutton", name, callback);
function Print() begin
     global Handle
     print getcontrol(Handle)'