// JavaScript
Checkbox1.onclick = function() {
var choices = "Choices: ";
for (i = 0; i <= Checkbox1.length - 1; i++) {
if (Checkbox1.getValue(i)) {
choices = choices + i + " ";
}
}
NSB.MsgBox(choices);
};
No edit summary |
|||
Line 41: | Line 41: | ||
Standard [[events|events]] are supported. For this control, the onclick event will be most useful. | Standard [[events|events]] are supported. For this control, the onclick event will be most useful. | ||
== Example | == Example == | ||
<tabber> | |||
JavaScript= | |||
< | <syntaxhighlight lang="JavaScript"> | ||
// JavaScript | |||
Checkbox1.onclick = function() { | Checkbox1.onclick = function() { | ||
var choices = "Choices: "; | var choices = "Choices: "; | ||
Line 64: | Line 55: | ||
} | } | ||
NSB.MsgBox(choices); | NSB.MsgBox(choices); | ||
};</ | }; | ||
</syntaxhighlight> | |||
|-| | |||
BASIC= | |||
<syntaxhighlight lang="vb.net"> | |||
' Basic | |||
Function Checkbox1_onclick() | |||
Dim choices = "Choices: " | |||
For i = 0 To Checkbox1.length-1 | |||
If Checkbox1.getValue(i) Then choices = choices & i & " " | |||
Next | |||
MsgBox choices | |||
End Function | |||
</syntaxhighlight> | |||
</tabber> | |||
== Output == | == Output == |
The Checkbox allows users to select a binary option from a list of one or more items.
Popovers and Tooltips are supported.
Standard properties are supported, plus:
addItem(item, type) | Adds an item to the end. type can be "checked" or "disabled" . Runtime. |
badge | Adds a Badge to the control. Design Time and Runtime. |
clear() | Clears all items. Runtime. |
footer | An optional message at the bottom of the list of items. Design Time and Runtime. |
getValue(i) | Get the value (true or false) of line i. Runtime. |
header | An optional message at the top of the list of items. Design Time and Runtime. |
icon | An optional icon to appear at the top of the list. Design Time and Runtime. |
inline | Display items horizontally? Design Time. |
items | Items to show, one per line. Prefix * for disabled, > for selected, ! for heading (not all controls support headings). Design Time. |
length | Items to show, one per line. Prefix * for disabled, > for selected, ! for heading (not all controls support headings). Design Time. |
setValue(i, value) | Set the value (true or false) of line i. Runtime. |
value | Sets or gets the value. Bootstrap 4: Gets or sets true/false for single row checkbox. |
Standard events are supported. For this control, the onclick event will be most useful.
// JavaScript
Checkbox1.onclick = function() {
var choices = "Choices: ";
for (i = 0; i <= Checkbox1.length - 1; i++) {
if (Checkbox1.getValue(i)) {
choices = choices + i + " ";
}
}
NSB.MsgBox(choices);
};
' Basic
Function Checkbox1_onclick()
Dim choices = "Choices: "
For i = 0 To Checkbox1.length-1
If Checkbox1.getValue(i) Then choices = choices & i & " "
Next
MsgBox choices
End Function