CreateListBox ( x,y,width,height,group[,style] )
Parameters
|
x,y - position of the list box's top-left corner within the group's client area width,height - size of the list box group - window or gadget group that owns the list box style (optional) - selection behaviour 0: single selection (default) bit 1: native extended multi-selection (Ctrl-click, Shift-click, keyboard) |
Description
|
Creates a list box gadget and returns its handle. Requires Extended language mode. The scrolling list at the heart of most tools - asset browsers, object lists, log summaries. Fill it with AddGadgetItem and friends; items are UTF-8 and can carry icons from a strip assigned with SetGadgetIconStrip. Selection comes in two flavours. The default is single-selection: SelectedGadgetItem returns the chosen index and SelectGadgetItem changes it. Style bit 1 turns on native extended multi-selection; SelectedGadgetItem then reports the lowest selected index and SelectGadgetItem still replaces the whole selection, so use CountSelectedGadgetItems, NextSelectedGadgetItem, GadgetItemSelected and SetGadgetItemSelected for additive, per-item selection work. Selection changes post gadget-action events ($401) through the shared event queue. On a multi-select list these are replaceable snapshots whose EventData is only the focused item (or -1), so enumerate the list in your handler rather than trusting the event. A right-click arrives as a mouse-down event ($201 with EventData 2) - the hook for opening a context menu with ShowPopupMenu. See it working in the selection and context menus sample and the layout and controls sample. See also: AddGadgetItem, SelectedGadgetItem, CountSelectedGadgetItems, SetGadgetItemSelected, CreateComboBox, ShowPopupMenu. |
Index