Blitz3D+ Command Reference

GadgetItemText$ ( gadget,index )

Parameters

gadget - combo box, list box or tabber gadget

index - item to read, starting at 0

Description

Returns the text of one item of a combo box, list box or tabber.

Requires Extended language mode.

Reads back an item's label as set by AddGadgetItem, InsertGadgetItem or ModifyGadgetItem. The everyday pairing is with a selection query - turning "item 3 is picked" into the actual name:

picked$=GadgetItemText(assetList,SelectedGadgetItem(assetList))

Items count from 0, and the index must be a real item - 0 up to CountGadgetItems-1 - or the call stops with a runtime error. Guard the SelectedGadgetItem pattern above against its -1 "nothing selected" result before passing it in.

Text is UTF-8, like everywhere in the GUI. As with tree nodes, if item text is really a key into your game data, storing your own arrays alongside the list is sturdier than parsing labels back.

See it working in the selection and context menus sample.

See also: AddGadgetItem, ModifyGadgetItem, CountGadgetItems, SelectedGadgetItem, GadgetText.

Index