Definition: |
include pGUI.e
Ihandle ih = IupGLToggle(nullable_string title=NULL, [[nullable_string action=NULL,] cbfunc func=NULL,] string attributes="", sequence data={}) |
Description: |
Creates an embedded OpenGL toggle interface element. It is a two-state (on/off) button that, when selected, generates an action that activates a function in the associated application. Its visual representation can contain a text and/or an image. It inherits from IupGLButton. It exists only inside an IupGLCanvasBox. title: Text to be shown on the toggle. It can be NULL. It will set the TITLE attribute. action: Name of the action specified by func, defaults to "ACTION", ignored if func is NULL. func: a callback address, usually specified as Icallback("name"). For more information on the attributes and data parameters see IupSetAttributes. This is a paranormalised function. Returns: the identifier of the created element. |
Notes: |
IupGLToggle visual is the same as a IupGLButton. There is no check mark.
To build a set of mutual exclusive toggles, insert them in a IupRadio container. They must be inserted before creation, and their behavior can not be changed. A toggle that is a child of an IupRadio automatically receives a name when its is mapped into the native system. (since 3.16) |
Attributes: | The IupGLToggle element handles all attributes defined for the IupGLButton control, and consequently for the IupGLLabel control and for the IupGLSubCanvas control too. |
CHECKMARK |
(non inheritable) Enables the check mark. Default: NO. When enabled the border and the background are not drawn, and a check mark box is drawn at left or right, according to RIGHTBUTTON. |
CHECKMARKWIDTH | (non inheritable) Size of the check mark. Default: 14. |
RADIO |
(read-only) returns if the toggle is inside a radio. Can be "YES" or "NO". Valid only after the element is mapped, before returns NULL. |
RIGHTBUTTON | (non inheritable) place the check button at the right of the text. Can be "YES" or "NO". Default: "NO". |
VALUE |
(non inheritable) Toggle’s state. Values can be "ON", "OFF" or "TOGGLE". Default: "OFF". The TOGGLE option will invert the current state. |
Callbacks | The IupGLToggle element handles all callbacks defined for the IupGLSubCanvas control. |
ACTION |
Action generated when the toggle’s state (on/off) was changed. The callback also receives the toggle’s state.
function action_cb(Ihandle ih, integer state) ih: identifier of the element that activated the event. state: 1 if the toggle’s state was set to on; 0 if it was set to off. Returns: IUP_CLOSE will be processed. |
VALUECHANGED_CB |
Called after the value was interactively changed by the user. Called after the ACTION callback, but under the same context.
function valuechanged_cb(Ihandle ih) ih: identifier of the element that activated the event. |
See Also: | IupImage, IupGLButton, IupGLLabel, IupRadio |