Shiny Language Reference

Language Reference > User Interface > List Boxes


removelistboxitembyindex

bool removelistboxitembyindex(int ID, int Index);

 

Synonyms:

bool removelistitembyindex(int ID, int Index);

bool removelbitembyindex(int ID, int Index);

 

Removes the item at the specified index from a list box

The REMOVELISTBOXITEMBYINDEX statement removes the item at the specified index from the list box. Indexes are unique, therefore this statement will only remove one item. An item's index is returned by the addlistboxitem statement.

 

Parameters

ID

The control ID of the control you wish to remove an item from

Index

The index of the item to remove

 

Return Value

TRUE if an item was removed, otherwise FALSE if the removal failed (due to an invalid index, invalid control ID or other similar causes).

 

Example Code

// Create the edit box X: 10, Y:10 and sized 200*120
int iListBoxID = createlistbox(1, 10, 10, 200, 120);

// Add "Test item" to the listbox
int Index = addlistboxitem(iListBoxID, "Test item");


// Remove the "Test item" string from the listbox using its index
removelistboxitembyindex(iListBoxID, Index);