Shiny Language Reference
Language Reference > User Interface > Buttons
User Interface Buttons
Creating and managing buttons
Although using buttons is easy, understanding how to fit the pieces together may not be immediately obvious. This download contains 3 sample plugins that demonstrate each part of the button system:
Inside the zip are 3 SSN plugin source files and one SSP plugin pack. To review the example code, unpack all the files in the zip to a temporary directory. Next install the buttondemo.ssp pack file into Brass using the "Install SSP" option in the Brass "File" menu. This installs an SSE along with 2 GIF images that are required for the samples to work. When the SSP has been installed you should have "buttondemo.sse" in the "<Brass Install Dir>\SSE" folder, and 2 GIF images ("normal.gif" and "pressed.gif") in "<Brass Install Dir>\SSE\buttondemo" folder.
The SSN's in the zip are as follows:
- buttondemo-handler.ssn: Demonstrates how to create a basic button that responds to being clicked on
- buttondemo-customdraw.ssn: Demonstrates how to create a custom-drawn button with transparent GIFs on the button face
- buttondemo.ssn: The complete source to the installed SSE, demonstrates how to use multiple custom drawn and standard buttons
Handler prototype for Buttons
function Handler_Name(int iControlID, int iMessage)
{
}
Valid Messages for Buttons
SSEdit #define Value Meaning BUTTON_CLICKED 0 Passed when a button is clicked with the left mouse button
createbutton - Creates a button in the display panel
setbuttonstyle - Sets the visual appearance of a button
setbuttondrawfunc - Allows a plugin to draw its own buttons
setbuttonfont - Sets the font used for the button caption
setbuttonfontcol - Sets the colour of the font used for the button caption