Shiny Language Reference
Language Reference > User Interface > Buttons
createbutton
int createbutton(int ID, int X, int Y, int Width, int Height);
Creates a button in the display panel
The CREATEBUTTON statement creates a user interface button in the plugin display panel. Buttons within Brass work exactly the same as buttons in Windows.
Every user interface element is assigned a "control ID". This ID uniquely references an individual control and is the method by which you access and manage the control.
CREATEBUTTON is the only statement you must call to create a working button in the display panel. The remaining button statements are provided for extra functionality and ease of use, however they are not mandatory.
Unlike Windows, Brass allows buttons to be stacked on top of each other. Buttons are ordered visually in the same order that they are created. Therefore to display smaller button A on top of larger button B, create button B before button A.
Parameters
ID
Your preferred control ID for this button. You may specify any positive (greater than 0) integer for a control ID. If you specify a control ID that is already in use, the CREATEBUTTON statement will return a new, unique ID for this control. Therefore you should assume that any value supplied for this parameter is only a suggestion, and the return value is the absolute control ID. You may specify integer 1 for every call to this statement, which will cause CREATEBUTTON to return sequential control IDs for you, removing the need to store the last used control ID.
X
The X pixel position within the display panel of the top left of the button
Y
The Y pixel position within the display panel of the top left of the button
Width
The width in pixels of the button
Height
The height in pixels of the button
Return Value
The actual control ID assigned to this control.
Example Code
// Create a 50x20 button at 10, 10 and store it's ID
int Id = createbutton(1, 10, 10, 50, 20);
// Create another button, supply 1 for the ID to receive the next free real ID
int Id = createbutton(1, 30, 30, 50, 20);