RadioButton

From Xojo Documentation

Revision as of 18:56, 19 November 2009 by WikiSysop (talk) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Description

The standard radio button control. If you enclose a group of radio button controls within a parent control (or just the parent window), REALbasic will automatically deselect the remaining radio buttons when the user clicks a radio button in the group.


Super Class

RectControl

Because this is a RectControl, see the RectControl for other properties and events that are common to all RectControl objects.


Events

Name Parameters Return Type Description
Action The RadioButton has been clicked.

A right+click does not trigger the Action event.

GotFocus The radio button has received the focus and has a selection marquee around its caption (Windows and Linux only).

On Linux, a RadioButton is not included in the Tab order but gets the focus when selected with the mouse or the arrow keys.

LostFocus The radio button has lost the focus and no longer has a selection marquee (Windows and Linux).
MouseDown x as Integer,

y as Integer

Boolean The mouse button was pressed inside the control's region at the location passed in to x,y.

Return True if you are going to handle the MouseDown. The Action event will not execute and the state of the object will not change.

MouseUp x as Integer,

y as Integer

Boolean The mouse button was released inside the control's region at the location passed in to x,y.

This event will not occur unless you return True in the MouseDown event. The return value is ignored.


Properties

Name Type Description
Bold Boolean Applies the bold style to the button caption.
Caption String The button's text.
Italic Boolean Applies the italic style to the button caption.
TextFont String Name of the font used to display the button caption.

You can enter any font that is installed on the computer or the names of REALbasic's two metafonts, "System" and "SmallSystem." The System font is the font used by the system software as its default font. Different operating systems use different default fonts. If the system software supports both a large and small System font, you can also specify the "SmallSystem" font as your TextFont. On Macintosh, "SmallSystem" specifies the OS's smaller system font. On Windows and Linux, "SmallSystem" is the same as "System."

TextSize
Changed 2009r4
Single
Size of the font used to display the button caption.

If you enter zero as the TextSize, REALbasic will choose the font size that works best for the platform on which the application is running.

Underline Boolean Applies the underline style to the button caption.
Value Boolean Gets or sets the value of the radio button: True if the RadioButton is checked and False if it is not checked.


Notes

If you have more than one group of radio buttons in a window, each group should have its own parent control. Radiobuttons within a group will be enabled and disabled automatically as the user clicks on a radiobutton within a group. You can use controls such as GroupBoxes, TabPanels, PagePanels, or even Canvases as parent controls.

If the Caption property contains an ampersand character, it will display only if it is preceded by another ampersand character. This is done to make applications on all platforms behave consistently.


Examples

The three RadioButtons are set up as a control array. That is, each RadioButton is named "RadioButton1" and their Index properties are set to 0, 1, and 2, respectively.

RadioButton1's Action event is passed the parameter, Index as Integer. The parameter Index contains the value of Index for the RadioButton that was clicked. Use a Select Case statement to determine which button was clicked

Sub Action (Index as Integer)
Select Case index
  Case 0
   StaticText1.text="VHS"
  Case 1
   StaticText1.text="DV"
  Case 2
   StaticText1.Text="8 mm"
 End Select


See Also

GroupBox, PagePanel, TabPanel control; RectControl class.