CheckBox: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
No edit summary
No edit summary
Line 3: Line 3:
:::::'''Classic                                                   jQuery Mobile'''
:::::'''Classic                                                   jQuery Mobile'''


'''Description'''
== Description ==


The CheckBox is used to display one or more on/off controls.
The CheckBox is used to display one or more on/off controls.
Line 11: Line 11:
To add a checkbox to your app, choose the Checkbox 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 button: usually, just onchange.
To add a checkbox to your app, choose the Checkbox 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 button: usually, just onchange.


'''Properties'''
== Properties ==


Standard [[properties and methods|properties]] are supported, plus:
Standard [[properties and methods|properties]] are supported, plus:
Line 25: Line 25:
|}
|}


'''Events'''
== Events ==


Standard [[events|events]] are supported. For this control, the onchange event will be most useful.
Standard [[events|events]] are supported. For this control, the onchange event will be most useful.


'''Example'''
== Example ==


<pre>
<pre>
REM Checkbox Example
Rem Checkbox Example
Function Checkbox1_onchange()
Function Checkbox1_onchange()
   Msgbox "Val is " & Checkbox1.getValue(1)
   Msgbox "Val is " & Checkbox1.getValue(1)
Line 38: Line 38:
</pre>
</pre>


'''Output'''
== Output ==


[[file:CheckboxOutput.jpg]]
[[file:CheckboxOutput.jpg]]
[[Category:Language Reference]]

Revision as of 04:45, 17 August 2012

Classic                                                   jQuery Mobile

Description

The CheckBox is used to display one or more on/off controls.

While a variety of different events are available, a handy response to clicking a checkbox is to call the function <buttonID>_onchange().

To add a checkbox to your app, choose the Checkbox 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 button: usually, just onchange.

Properties

Standard properties are supported, plus:

options A comma separated list of titles for the checkboxes.
orientation Horizontal or vertical. jQuery Mobile only.
getValue(n) Get the value of checkbox n, which will be true or false. n starts a 1 for the top checkbox.
setValue(n, val) Sets the value of checkbox n to true or false. This function should not be called until the checkbox is fully drawn, in Sub Main or later.

Events

Standard events are supported. For this control, the onchange event will be most useful.

Example

Rem Checkbox Example
Function Checkbox1_onchange()
  Msgbox "Val is " & Checkbox1.getValue(1)
End Function

Output