Shiny Language Reference

Language Reference > User Interface > List Boxes


removelistboxitem

bool removelistboxitem(int ID, string Item);

 

Synonyms:

bool removelistitem(int ID, string Item);

bool removelbitem(int ID, string Item);

 

Removes the specified string from a list box

The REMOVELISTBOXITEM statement removes the first instance of the an item with the specified text from the list box. Note that more than one item may have the same item text, therefore depending on the requirement you have two options.

First, to remove all items with the specified text you should use a while loop to repeatedly call REMOVELISTITEM until it returns FALSE.

Second, to remove a specific item you should consider using removelistboxitembyindex.

 

Parameters

ID

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

Item

The item string to remove

 

Return Value

TRUE if an item was removed, otherwise FALSE.

 

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
addlistboxitem(iListBoxID, "Test item");


// Remove the "Test item" string from the listbox
removelistboxitem(iListBoxID, "Test item");