Blitz3D+ Command Reference

SetGadgetItemSelected listbox,index[,selected]

Parameters

listbox - list box gadget

index - item to change, starting at 0

selected (optional) - 1 selects the item (default); 0 deselects it

Description

Selects or deselects one list box item without touching the rest of the selection.

Requires Extended language mode.

This is the additive partner of SelectGadgetItem. On a multi-select list box (style 1) it adds the item to, or removes it from, whatever is already selected - exactly what a Select All menu command or a saved-selection restore needs. On a single-select list box, selecting an item still replaces the previous selection, and deselecting simply clears it.

Selecting an item also scrolls it into view. The call is silent - no $401 gadget-action event is posted - and an index outside the item range stops with a runtime error.

Read the result back with GadgetItemSelected for one item, or CountSelectedGadgetItems and NextSelectedGadgetItem for the whole set.

See it working in the selection and context menus sample.

See also: GadgetItemSelected, CountSelectedGadgetItems, NextSelectedGadgetItem, SelectGadgetItem, CreateListBox.

Index