|
|
(9 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| [[file:FlipToggle.jpg]] | | [[file:FlipToggle.png]] |
|
| |
|
| == Description == | | == Description == |
Line 6: |
Line 6: |
|
| |
|
| To add a FlipToggle to your app, choose the FlipToggle icon in the Toolbar, then position it on the Design Screen. Use the Property Editor to set the properties you need, then add functions to your code to respond to the events that come from the FlipToggle: usually, just onclick. | | To add a FlipToggle to your app, choose the FlipToggle icon in the Toolbar, then position it on the Design Screen. Use the Property Editor to set the properties you need, then add functions to your code to respond to the events that come from the FlipToggle: usually, just onclick. |
| | |
| | If you set disabled to true, events will still fire. You will need to ignore the events in your code. |
|
| |
|
| == Properties == | | == Properties == |
Line 13: |
Line 15: |
| |- | | |- |
| | value() || The value of the control. | | | value() || The value of the control. |
| | |- |
| | | setting() || Current setting of control. True/False. |
| |- | | |- |
| | setValue() || Set the value to one of the titles. | | | setValue() || Set the value to one of the titles. |
| |- | | |- |
| | titleLeft || The name of the left title. Design only. | | | titleLeft || The name of the left title. Limited to about 5 characters. Design only. |
| |- | | |- |
| | titleRight || The name of the left title. Design only. | | | titleRight || The name of the left title. Limited to about 5 characters. Design only. |
| |} | | |} |
|
| |
|
Line 25: |
Line 29: |
| Standard [[events|events]] are supported. | | Standard [[events|events]] are supported. |
|
| |
|
| == Example (Basic) == | | == Example == |
| | |
| | <tabber> |
| | JavaScript= |
| | <syntaxhighlight lang="JavaScript"> |
| | FlipToggle1.onchange = function() { |
| | Button1.value = FlipToggle1.value(); |
| | }; |
| | |
| | Button1.onclick = function() { |
| | NSB.MsgBox(FlipToggle1.value()); |
| | }; |
| | |
| | Button2.onclick = function() { |
| | //set to text value of the option you want. |
| | FlipToggle1.setValue("On"); |
| | }; |
| | </syntaxhighlight> |
| | |-| |
| | BASIC= |
| | <syntaxhighlight lang="vb.net"> |
| | Function FlipToggle1_onchange() |
| | Button1.value = FlipToggle1.value() |
| | End Function |
|
| |
|
| <pre>
| | Function Button1_onclick() |
| Print FlipToggle1.value
| | MsgBox FlipToggle1.value() |
| </pre>
| | End Function |
|
| |
|
| == Example (JavaScript) ==
| | Function Button2_onclick() |
| <pre>
| | 'set to text value of the option you want. |
| NSB.Print(FlipToggle1.value);
| | FlipToggle1.setValue("On") |
| </pre> | | End Function |
| | </syntaxhighlight> |
| | </tabber> |
|
| |
|
| == Output == | | == Output == |
Description
The FlipToggle control is a slider that changes between Off and On.
To add a FlipToggle to your app, choose the FlipToggle icon in the Toolbar, then position it on the Design Screen. Use the Property Editor to set the properties you need, then add functions to your code to respond to the events that come from the FlipToggle: usually, just onclick.
If you set disabled to true, events will still fire. You will need to ignore the events in your code.
Properties
Standard properties are supported, plus:
value() |
The value of the control.
|
setting() |
Current setting of control. True/False.
|
setValue() |
Set the value to one of the titles.
|
titleLeft |
The name of the left title. Limited to about 5 characters. Design only.
|
titleRight |
The name of the left title. Limited to about 5 characters. Design only.
|
Events
Standard events are supported.
Example
FlipToggle1.onchange = function() {
Button1.value = FlipToggle1.value();
};
Button1.onclick = function() {
NSB.MsgBox(FlipToggle1.value());
};
Button2.onclick = function() {
//set to text value of the option you want.
FlipToggle1.setValue("On");
};
Function FlipToggle1_onchange()
Button1.value = FlipToggle1.value()
End Function
Function Button1_onclick()
MsgBox FlipToggle1.value()
End Function
Function Button2_onclick()
'set to text value of the option you want.
FlipToggle1.setValue("On")
End Function
Output
Off