Blitz3D+ Command Reference

RemoveGadgetItem gadget,index

Parameters

gadget - combo box, list box or tabber

index - item to remove, starting at 0

Description

Removes one item from a combo box, list box or tabber.

Requires Extended language mode.

Every item after the removed one shifts down by one index. That matters when deleting several items in one go - walk the list backwards so the indices you have not visited yet stay valid:

For index=CountGadgetItems(gadget)-1 To 0 Step -1
    If GadgetItemSelected(gadget,index) Then RemoveGadgetItem gadget,index
Next

An index outside the current item range stops with a runtime error. Removing items programmatically posts no $401 event, so update any dependent labels or state yourself afterwards. To empty the whole gadget at once, ClearGadgetItems is simpler and faster.

See it working in the selection and context menus sample.

See also: AddGadgetItem, InsertGadgetItem, ClearGadgetItems, CountGadgetItems, ModifyGadgetItem.

Index