Blitz3D+ Command Reference

InsertGadgetItem gadget,index,item$[,icon]

Parameters

gadget - combo box, list box or tabber gadget

index - position for the new item, from 0 up to the current item count

item$ - text of the new item

icon (optional) - icon index from the strip assigned with SetGadgetIconStrip; -1 for no icon (default)

Description

Inserts an item at a chosen position in a combo box, list box or tabber.

Requires Extended language mode.

The positional sibling of AddGadgetItem, which appends. Use it when order carries meaning - keeping an asset list alphabetical as things are added, or placing a new tab beside the one it was cloned from. Index 0 puts the item first, existing items from that position shift down, and an index equal to CountGadgetItems appends. Anything outside 0..count stops with a runtime error.

Inserting is silent - no $401 is posted, and it does not select the new item; follow up with SelectGadgetItem or SetGadgetItemSelected if the new entry should be picked. Item text is UTF-8.

One thing to keep straight: item indexes are positions, not identities. Inserting shifts the indexes of everything after it, so refresh any indexes you stored - or store the text or your own data instead.

The selection and context menus sample shows the list handling this slots into.

See also: AddGadgetItem, ModifyGadgetItem, RemoveGadgetItem, CountGadgetItems, GadgetItemText.

Index