Klang C++ 0.7.15
Language Reference (draft)
Loading...
Searching...
No Matches
Toggle

Language Guide / Controls and Parameters · Generated API signature

Toggle

klang::Toggle

Creates an on/off control.

Use a toggle for a persistent on/off setting. Pass the initial state as a boolean. It defaults to false. The control value is 0 or 1.

Basic use

Add the control to the model’s Controls collection during setup.

controls = { Toggle("Enabled") };

Optional properties

Pass true as the second argument to start enabled.

controls = { Toggle("Enabled", true) };

Optional placement and size

Pass Control::Size as the last argument. Its values are x, y, width, and height. Omit it for automatic layout.

controls = { Toggle("Enabled", true, { 0, 0, 80, 24 }) };