RADIOGROUP

From Liberty BASIC Family
Revision as of 02:04, 11 October 2023 by StPendl (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Not supported in Just BASIC Not supported in Liberty BASIC Not supported in Liberty BASIC 5 Supported in Run BASIC

Description

A radio group is a group of buttons that function together. Each has a text label and a small, round button that can be filled, or cleared. Only one in a set of radio buttons can be checked at a time, so checking one automatically unchecks others in the group.
Multiple radio groups may be used in a program.

Syntax

  1. RADIOGROUP #handle, choicesExpr$, choice$ - Insert radio buttons defined by comma delimited choicesExpr$ with selection choice$

Hints

If choice$ is an empty string, no button is set initially.

RADIOGROUP methods

Example

The following demo creates a radio group, then retrieves the text of the selected button.

radiogroup #rad, "Red, Green, Blue", "Blue"
sel$ = #rad selection$()
print sel$

The following demo creates a radio group and causes the layout to be horizontal.

radiogroup #rad, "Red, Green, Blue", "Blue"
'horizontal layout
#rad horizontal(1)

The following demo creates two radio groups. It causes the first radio group to be laid out horizontally. The second radio group is created with no button set.

radiogroup #rad, "Red, Green, Blue", "Blue"
#rad horizontal(1)
print:print "---------"
radiogroup #rad2, "Small, Medium, Large", ""
#rad2 horizontal(0)

This code demonstrates the Debug$() and IsNull() methods.

print "Before creation, IsNull() returns:"
print #rad isnull()
print
radiogroup #rad, "Red, Green, Blue", "Blue"
print
print "Object is a ";#rad debug$()
print
print "After creation, IsNull() returns:"
print #rad isnull()
wait

Practical implementation of radio group.

radiogroup #rg1, "Button 1,Button 2,Button 3", "Button 1" 
#rg1 horizontal(1)
link #go, " [Submit]", [go]
wait
[go]
sel$ = #rg1 selection$()
print:print
print sel$;" is selected"
wait

Useful Procedures

' Place a useful function or sub using this keyword here