Shiny Language Reference
Language Reference > User Interface > Static Text
User Interface Text Controls
Creating and managing static text controls
Static text controls provide an easy way for plugins to display styled text in the plugin display panel. They are designed to display multiple lines of text within a fixed area (boundary), in any font and with an optional background.
When should I use static text controls, and when should I use standard text drawing?
Although static text controls and standard text drawing (such as createfont, drawtext etc) appear to have the same result they are very different in operation.
Because static text controls are part of the Brass user interface system, they have the following properties:
Can be managed and controlled using the user interface statements, including changing the alphablend opacity- Can have an associated event handler that responds to a mouse click
- Automatically enabled for the 100% Configuration System
Because standard text drawing is not part of the user interface system, any text drawn cannot benefit from the 100% Configuration System. This means that you cannot drag, resize and change the appearance of the text simply by clicking in the plugin display panel. A flash movie of the 100% Configuration System in action is available on the Brass Movie Page, and further information is also available here.
In summary: if you want to display text in the panel that should not be moved or changed by the user (such as a copyright notice or a logo), use standard text drawing. If you want to display text that can be moved, resized and have its style changed, use a static text control.
Why are they called "static" controls?
The name "static" is used to show a clear difference between the text control and standard text drawing (such as createfont, drawtext etc). It is simply a name, and does not mean the content of the control cannot be changed. Microsoft also uses the static term to refer to the Windows control that does the same thing.
This download contains a sample plugin that demonstrates using static text controls:
Download statictextdemo.zip here
To review the example code, unpack all the files in the zip to a temporary directory. Next install the statictextdemo.ssp pack file into Brass using the "Install SSP" option in the Brass "File" menu. When the SSP has been installed you should have "textdemo.sse" in the "<Brass Install Dir>\SSE" folder, and the source code to the demo in "<Brass Install Dir>\SSE\TextDemo" folder.
Handler prototype for Text Controls
function Handler_Name(int iControlID, int iMessage)
{
}
Valid Messages for Text Controls
SSEdit #define Value Meaning TEXT_CLICKED 0 Passed when a text control is clicked with the left mouse button
createstatictext - Creates a static text control in the display panel
setstatictextstyle - Sets the background appearance of a static text control
setstatictextfont - Sets the font used for the control text
setstatictextfontcol - Sets the colour of the font used for the button caption
setstatictextformatting - Sets the alignment and format options of the text in the control