IMAGE_PARAM_BUTTON
Active element that displays an image depending on the value of the parameter and that can be clicked to increment the value.
It is as an animation or 'filmstrip' for which the image is chosen depending on the value of the parameter: if the parameter value is equal to its minimum the first image is displayed. If the parameter value is equal to its maximum, the last image is displayed.
The control supports several keyboard shortcuts and mouse click. Each time the user clicks on the button, the parameter is incremented to next value (the number of possible values depending on the number of images).
Attributes brief detailed show all inherited
Examples
Display an 'On/Off' two states button (in this case a switch and a checkbox) for a boolean parameter from the default skin.
- <!-- create demo param -->
- <PARAM id="demo_param" min="0" max="1" default="0" />
- <!-- control param via a "switch" -->
- <IMAGE_PARAM_BUTTON param_id="demo_param" image="$PLUGIN_DATA_PATH$/Skins/Controls/Other/vintage_switch.png" opaque_mouse_mask="true" cursor="system::hand" />
- <!-- display/control param as checkbox/text -->
- <ROW spacing="8">
- <!-- checkbox from the default theme -->
- <IMAGE_PARAM_BUTTON param_id="demo_param" image="$PLUGIN_DATA_PATH$/Skins/Modern-Theme/buttons/check_box.svg" opaque_mouse_mask="true" cursor="system::hand" image_scaling="1.5" />
- <!-- text control -->
- <PARAM_TEXT_CONTROL param_id="demo_param" />
- </ROW>

The original image for the switch has two sprites placed vertically.
By the way, using opaque_mouse_mask="true" we can make the whole image react to mouse events (otherwise the empty parts of the image will be ignored).

Another image check_box.svg also has two sprites.
Notice that because it is a vector image it can be scaled freely without loosing sharpness using image_scaling attribute.
Improving user experience
You also can add disabled/hover/focus/pushed images for IMAGE_PARAM_BUTTON to make your control look slighly different in different states. Simple example from the default theme, where "pushed" control displays its thumb centered:
- <IMAGE_PARAM_BUTTON param_id="demo_param" image="$PLUGIN_DATA_PATH$/Skins/Modern-Theme/switches/h_select_switch.png" cursor="system::hand" />

There are two images for that control:
h_select_switch.png and
h_select_switch_pushed.png
Multiple param values
You can have an image with multiple sprites to control several "steps" of a parameter. Say your parameter can have values from 0 to 20. Then you create an image with 20 sprites and set images_count="20" in IMAGE_PARAM_BUTTON.
- <IMAGE_PARAM_BUTTON param_id="demo_param" image="$PLUGIN_DATA_PATH$/Skins/Controls/Meters/red_led.png" opaque_mouse_mask="true" cursor="system::hand" images_count="21" loop="false" />
Noticed we also used loop="false" so that after reaching last value param doesn't roll back to the first one.

For the demo we used an LED image from the default theme with 21 sprites in it, but in practice the IMAGE_PARAM_BUTTON is used for boolean parameters or integer parameters that do not have more than 3 values.
More info
As with other "IMAGE" controls, IMAGE_PARAM_BUTTON is often used with DEFINE to create a reusable item. See an example in IMAGE_ACTION_BUTTON.
If you need an invisible control with same mouse behaviour (but without the image) see INVISIBLE_PARAM_BUTTON.
Comments
Please, authorize to view and post comments.