RadioButton: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Brendon (talk | contribs)
No edit summary
Brendon (talk | contribs)
No edit summary
Line 3: Line 3:
:::::'''Classic                                                    jQuery'''
:::::'''Classic                                                    jQuery'''


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


The RadioButton is used to display a list of mutually exclusive options.
The RadioButton is used to display a list of mutually exclusive options.
Line 11: Line 11:
To add a radiobutton to your app, choose the Radiobutton 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 radiobutton to your app, choose the Radiobutton 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 29: Line 29:
|}
|}


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


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


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


<pre>
<pre>
Line 51: Line 51:
</pre>
</pre>


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


<pre>
<pre>
(depends on input)
(depends on input)
</pre>
</pre>
[[Category:Language Reference]]

Revision as of 16:50, 17 August 2012

Classic                                                    jQuery

Description

The RadioButton is used to display a list of mutually exclusive options.

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

To add a radiobutton to your app, choose the Radiobutton 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:

getValue(n) Get the value of line n, which will be true or false. n starts a 1 for the top line.
items A comma separated list of titles for the buttons. (Design time)
orientation Horizontal or vertical. Design time, jQuery Mobile only.
setValue(n, val) Sets the value of line n to true or false. This function should not be called until the checkbox is fully drawn, in Sub Main or later.
value Which item should be initially checked? (Design time)
value() Returns the number of the currently selected item.

Events

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

Example

RadioButton_jqm1.setValue(2, True)
RadioButton_jqm2.setValue(1, True)
 
Function RadioButton_jqm1_onchange()
  MsgBox "One is " & RadioButton_jqm1.getValue(1) & vbCRLF & _
         "Two is " & RadioButton_jqm1.getValue(2)
End Function
 
Function RadioButton_jqm2_onchange()
  MsgBox "One is " & RadioButton_jqm2.getValue(1) & vbCRLF & _
         "Two is " & RadioButton_jqm2.getValue(2) & vbCRLF & _
         "Three is " & RadioButton_jqm2.getValue(3)
End Function

Output

(depends on input)