Checkables - Grisgram/gml-raptor GitHub Wiki

You are here:

Base Controls - Containers - Tooltips - Clickables - ✔Checkables - ListBox - InputBox - Mouse Cursor - ControlTree


Checkable Controls

The form the last group of controls, those with a checked state. raptor offers a CheckBox and a RadioButton in this category.

This group adds these variables to the list:

image

on_checked_changed A callback, like the ones from the other control groups. This one triggers, when the checked state has been changed through the set_checked function
checkmark_draw_color Another blend color, based on the UI Themes
draw_checkbox_on_the_left You decide, whether the checkmark is rendered like [x] Some text or like Some text [x]
distance_to_text The amount of pixels between the checkmark and the text of the control
checked The state of the control
image_index_default
image_index_mouse_over
image_index_mouse_down
image_index_checkmark
Best way, to understand this, is to take a look at the underlying sprite of a checkable control (see examples below). Set the image_index values for each of the possible events here

The Sprite layout of a checkable control

It's quite easy, for checkables you should create a sprite with 4 frames, at 0 fps animation speed.
The frames are, from left to right, default, mouse_over, mouse_down and the checkmark.

Here are examples, the default sprites that come with raptor:

CheckBox RadioButton
sprCheckbox_strip4 sprRadiobutton_strip4

The RadioButton

The RadioButton adds one additional variable definition to the mix:

image

To support multiple groups of RadioButtons in a single window, we need some variable to indicate, to which group a button belongs.

If you have only one radio group in your Window, you can leave this setting alone, as an empty string is also a unique string, like any other string, when there's only one.
However, if you have two or more radio groups in the window, you need to assign each of them the group name, they belong to.
Clicking a RadioButton will uncheck all other buttons of the same group (and launch their on_checked_changed callback if necessary), and then check the clicked RadioButton and its callback.


You are here:

Base Controls - Containers - Tooltips - Clickables - ✔Checkables - ListBox - InputBox - Mouse Cursor - ControlTree

⚠️ **GitHub.com Fallback** ⚠️