TRadio

Source: source/classes/radio.prg

Inherits from: TControl

TRadio implements an individual radio button (auto radio button style). Radio buttons are used in groups where only one option can be selected at a time. They are typically managed by a TRadMenu parent that handles mutual exclusion and keyboard navigation within the group.

Key DATA Members

DATATypeDescription
lCheckedLogicalCurrent checked state of the radio button
oRadMenuObjectParent TRadMenu that manages this radio button group
nPosNumericPosition/index of this button within the group

Methods

MethodDescription
New( nRow, nCol, cPrompt, oWnd, bSetGet, lChecked, nPos, oRadMenu )Create a radio button; bSetGet is a SETGET code block for the selected value
Redefine( nId, lChecked, nPos, oDlg, oRadMenu )Redefine from a dialog resource
SetCheck( lOnOff )Set the checked state and update Windows button control
IsChecked()Query the button's checked state from Windows
Check()Set checked to .T. (convenience method)
UnCheck()Set checked to .F. (convenience method)
Click()Handle click: selects this button in the parent TRadMenu and refreshes

Commands

@ nRow, nCol RADIO oRad VAR nOpt PROMPT cText OF oDlg

Example: Radio Group with TRadMenu

#include "FiveWin.ch"

function Main()

   local oWnd, oRadMenu, nOption := 1

   DEFINE WINDOW oWnd TITLE "Radio Demo" SIZE 300, 200

   @ 10, 10 RADIO oRadMenu VAR nOption ;
      ITEMS "Option &1", "Option &2", "Option &3" ;
      OF oWnd SIZE 120, 80

   @ 100, 10 BUTTON "Show" SIZE 60, 25 OF oWnd ;
      ACTION MsgInfo( "Selected: " + Str( nOption ) )

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

See Also