Shiny Language Reference
Language Reference > User Interface > Static Images
User Interface Image Controls
Creating and managing static image controls
Static image controls provide an easy way for plugins to display images in the plugin display panel.
When should I use static image controls, and when should I use standard image drawing?
Although static image controls and standard image drawing (such as createimage, drawimage etc) appear to have the same result they are very different in operation.
Because static image 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 image drawing is not part of the user interface system, any image drawn cannot benefit from the 100% Configuration System. This means that you cannot drag, resize and change the appearance of the image 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 images in the panel that should not be moved or changed by the user (such as a copyright notice or a logo), use standard image drawing. If you want to display images that can be moved and resized, use a static image control.
Why are they called "static" controls?
The name "static" is used to show a clear difference between the image control and standard image drawing (such as createimage, drawimage 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 image controls:
Download staticimagedemo.zip here
To review the example code, unpack all the files in the zip to a temporary directory. Next install the staticimagedemo.ssp pack file into Brass using the "Install SSP" option in the Brass "File" menu. When the SSP has been installed you should have "imagedemo.sse" in the "<Brass Install Dir>\SSE" folder, and the source code to the demo in "<Brass Install Dir>\SSE\ImageDemo" folder.
Handler prototype for Image Controls
function Handler_Name(int iControlID, int iMessage)
{
}
Valid Messages for Image Controls
SSEdit #define Value Meaning IMAGE_CLICKED 0 Passed when an image control is clicked with the left mouse button
createstaticimage - Creates a static image control in the display panel and optionally loads an image into it
setstaticimagedrawfunc - Sets a function for "callback" to draw a custom static image control