Shiny Language Reference

Language Reference > User Interface > List Boxes


setlistboxcursel

setlistboxcursel(int ID, int Index);

 

Synonyms:

setlistcursel(int ID, int Index);

setlbcursel(int ID, int Index);

 

Sets the currently selected item in a listbox

The SETLISTBOXCURSEL statement sets the currently selected item in a list box. This statement does not cause Brass to call your list box handler with a notification of LISTBOX_SELCHANGE.

 

Parameters

ID

The control ID of the control you wish to set the selection in

Index

The zero-based new selection index

 

Return Value

None

 

Example Code

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

// Add 25 test items
for(int iTest = 0; iTest < 25; iTest++)
    addlistboxitem(iListBoxID, "Test item " + iTest);


// Set the selection to item 10 (11th item)
setlistboxcursel(10);