Shiny Language Reference

Language Reference > User Interface > List Boxes


User Interface List Boxes

Creating and managing list controls

 

Although using listboxes is easy, understanding how to fit the pieces together may not be immediately obvious. This download contains a sample plugin that demonstrates how to use listboxes.

Download listboxdemo.zip here

Inside the zip is one SSP plugin pack. Install the listboxdemo.ssp pack file into Brass using the "Install SSP" option in the Brass "File" menu. This installs an SSE along with multiple PNG images that are required for the sample to work. When the SSP has been installed you can find the source code in <Brass Install Folder>\SSE\ListBoxDemo.

The SSN demonstrates how to create and use simple listboxes, as well as how to create and use custom drawn listboxes with PNG images.

 

Handler prototype for List boxes

function Handler_Name(int iControlID, int iMessage)
{
}

Valid Messages for List boxes

SSEdit #define Value Meaning
 
LISTBOX_GOTFOCUS 0 Passed when the control is left clicked to activate it
   
LISTBOX_LOSTFOCUS 1 Passed when a previously activated control loses the input focus
   
LISTBOX_SELCHANGE 2 Passed when the user changes the selected item
   
LISTBOX_DBLCLICK 3 Passed when the user double clicks with the left mouse button in the control

SSEdit contains a templatized handler function for use in your plugins. You may insert the template into your code using the SSEdit Code Wizard.

 

To manipulate the scrollbar attached to the list control, refer to the scrollbar reference.

createlistbox - Creates a list box

setlistboxstyle - Sets the visual style of a listbox

setlistboxdrawfunc - Sets a listbox to be custom drawn, sets the custom draw handler

setlistboxfont - Sets the font used for the listbox

setlistboxfontcol - Sets the font colour used in the listbox

addlistboxitem - Adds an item and optional extra data to the listbox

removelistboxitem - Removes an item from a listbox by text matching

removelistboxitembyindex - Removes an item from a listbox by its index

setlistboxitemtext - Changes the text of a listbox item

getlistboxitemtext - Retrieves the text of a listbox item

setlistboxitemextra - Sets the extra data associated with a listbox item

getlistboxitemextra - Retrieves the extra data associated with a listbox item

setlistboxcursel - Sets the currently selected item index

getlistboxcursel - Retrieves the currently selected item index

setlistboxtextrect - Sets the bounding rectangle for all text in the listbox

resetlistbox - Resets the contents of a listbox to empty