Shiny Language Reference

Language Reference > User Interface > List Boxes


setlistboxitemextra

bool setlistboxitemextra(int ID, int Index, dword Extra);

 

Synonyms:

bool setlistitemextra(int ID, int Index, dword Extra);

bool setlbitemextra(int ID, int Index, dword Extra);

 

Changes the extra data of the specified item

The SETLISTBOXITEMEXTRA statement changes the extra data associated with the item at the specified index in the list box. Indexes are unique, therefore this statement will only alter one item. An item's index is returned by the addlistboxitem statement.

You can use this dword to store item-specific data. For example, if a list box is populated with the contents of an array, the extra data can be used to store the element number of each list box item in its original array. Then, when an item is clicked, the extra data can be read using getlistboxitemextra to immediately retrieve the original array index. This is much faster than iterating through an array to find a matching element. It also ensures uniqueness.

Extra data is purely used for the plugin, Brass does not use or alter the extra data of an item in any way.

 

Parameters

ID

The control ID of the control you wish to change the item text in

Index

The index of the item to change

Extra

The extra data to associate with this item

 

Return Value

TRUE if an item was changed, otherwise FALSE if the change 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");


// Associate a dword with the "Test item" string
setlistboxitemextra(iListBoxID, Index, 0x12345678);