Blitz3D+ Command Reference

GadgetItemSelected ( listbox,index )

Parameters

listbox - list box gadget

index - item to test, starting at 0

Description

Returns True if the list box item at an index is selected, False if not.

Requires Extended language mode.

The direct membership test for a list selection. It works on both flavours of list box: on the default single-select list at most one index answers True; on a style-1 multi-select list any number can. Typical use is deciding per row - walking all items and acting on the picked ones, or checking whether the row under a context menu is part of the current selection before showing selection-wide actions.

For visiting only the selected rows, CountSelectedGadgetItems plus NextSelectedGadgetItem is the faster loop; GadgetItemSelected shines when you already have an index in hand.

The index must be a real item - 0 up to CountGadgetItems-1 - or the call stops with a runtime error. The query itself is silent and posts no events.

Change selection from code with SetGadgetItemSelected (additive) or SelectGadgetItem (replaces the whole selection).

See it working in the selection and context menus sample.

See also: CountSelectedGadgetItems, NextSelectedGadgetItem, SetGadgetItemSelected, SelectedGadgetItem, CreateListBox.

Index