multilistbox

User Interface Controls > Common Properties > Layout > Types > MultiListbox

 

   

Creating User Interfaces - Quick Navigation

A MultiListBox item is used to place a list box in the rollout. This is a variant of the ListBox in which multiple items in the list can be selected.

The syntax is:

MultiListBox <name> [<caption>] [items:<array_of_strings>] \
[selection:{<bitarray> | <number_array> | <number>}] \
[height:<number> ] 	 

The default alignment of MultiListBox items is #left .

EXAMPLE:

rollout test "test"
(
  multiListBox mlb "MultiListBox" items:#("A","B","C") selection:#(1,3)
  on mlb selected val do format "selected: % - %\n" val mlb.selection[val]
  on mlb doubleclicked val do format "doubleclicked: % - %\n" val mlb.selection[val]
  on mlb selectionEnd do format "selectionEnd: %\n" mlb.selection
)
rof=newrolloutfloater "tester" 200 300
addrollout test rof
test.mlb.items
test.mlb.selection=1
test.mlb.selection=#(1,3)
test.mlb.selection=#{}

   

Parameters:

items:   

The array of text strings that are the items in the list.

   

selection: 

A BitArray signifying the currently selected items in the list. The default selection value is #{}.

   

height: 

The overall height of the MultiListBox in number of item lines. Defaults to 10 lines. To have a MultiListBox display exactly N items, set height to N.

   

Properties:

<listbox>.items Array of Strings 

The item string array.

   

<listbox>.selection BitArray 

The currently selected items. When setting the selection via a script, the selection can be specified as a BitArray, Array of numbers, or a number. If the items list is an empty array, this value is 0.

   

Events:

on <listbox> selected <arg> do <expr> 

Called when the user selects or deselects an item in the list. The <arg> argument contains the index of the item that was selected or deselected. Since multiple items can be selected or deselected at once, this handler is called for each item in the list, starting from the top of the list, whose selection has changed.

   

on <listbox> selectionEnd do <expr> 

Called when the user selects or deselects an item in the list, but after all the calls to the on selected handler have been made.

NOTE:

There isn't a way to deselect all the items in the list by clicking in the list somewhere, although it is possible by holding down Ctrl key and clicking the last selected item.

To clear the list selection you might want to add a "Clear Selection" button that sets selection=#{}.

   

on <listbox> doubleClicked <arg> do <expr> 

Called when the user double-clicks on an item in the list. Note that the on selected handler is always called on single clicks and on the first click of a double-click. The <arg> argument contains the number of the item double-clicked.

   

on <listbox> rightClick do <expr> 

Called when the user right-clicks in the Multilistbox control.

Available in 3ds Max 2010 and higher.

See Also