An on/off button-like control. More...
Import Statement: | import Felgo 4.0 |
Inherits: |
This displays a slide-able switch which can be used to toggle some functionality on or off.
It has a checked property, that can be modified by the user, either by sliding the switch to the left (off) or to the right (on), or by simply tapping on it (toggles on/off).
It will emit the signal toggled, when the checked state has changed. By default, the styling of the button is changed to match different platforms.
[since Felgo 2.7.0] backgroundBorderColor : color |
The color of the background's border. Matches platform specific values by default.
This property was introduced in Felgo 2.7.0.
[since Felgo 2.7.0] backgroundBorderWidth : real |
The width of the background's border. Matches platform specific values by default.
This property was introduced in Felgo 2.7.0.
[since Felgo 2.6.2] backgroundColorOff : color |
The background color when the switch is off.
This property was introduced in Felgo 2.6.2.
[since Felgo 2.6.2] backgroundColorOffPressed : color |
The background color when the switch is off and pressed.
This property was introduced in Felgo 2.6.2.
[since Felgo 2.6.2] backgroundColorOn : color |
The background color when the switch is on.
This property was introduced in Felgo 2.6.2.
[since Felgo 2.6.2] backgroundColorOnPressed : color |
The background color when the switch is on and pressed.
This property was introduced in Felgo 2.6.2.
checked : bool |
A Boolean property that determines the off/on state of the switch. Set this property to true
or false
to change the switch's state.
See also toggle() and setChecked().
[since Felgo 2.6.2] dropShadow : bool |
Whether the knob should drop a shadow.
This property was introduced in Felgo 2.6.2.
[since Felgo 2.6.2] knobBorderColor : color |
The border color of the knob.
This property was introduced in Felgo 2.6.2.
[since Felgo 2.7.0] knobBorderWidth : real |
The width of the knobs's border. Matches platform specific values by default.
This property was introduced in Felgo 2.7.0.
[since Felgo 2.6.2] knobColorOff : color |
The knob color when the switch is off.
This property was introduced in Felgo 2.6.2.
[since Felgo 2.6.2] knobColorOn : color |
The knob color when the switch is on.
This property was introduced in Felgo 2.6.2.
[read-only, since Felgo 2.7.0] pressed : bool |
Whether the switch is currently being pressed.
This property was introduced in Felgo 2.7.0.
updateChecked : bool |
If set to false
, the checked property is not changed when this control is toggled. Can be useful if it is bound to some other value.
toggled() |
Emitted each time the checked state of the switch changes. This is the case when the user toggles the button or it gets set from within your code.
Note: The corresponding handler is onToggled
.
setChecked(checked) |
toggle() |
Call this method to toggle the current checked state of the switch. If the switch is currently off it changes to on and vice-versa.
See also checked and setChecked().