Classes

Class XbpRadioButton() Foundation

Class function of the XbpRadioButton class.

Superclass
Description

The XbpRadioButton class provides the radio button dialog element. A radiobutton, like a checkbox, can be in one of two available states: "selected" or "not selected". These two conditions are identified by the logical values .T. (true) and .F. (false).

A radiobutton differs from a checkbox in that it must always be part of a group of two or more radiobuttons. Within each group of radiobuttons only a single radiobutton can be selected at any one time. The relationship of a radiobutton to the group is defined by the parent and owner of the radiobuttons. All radiobuttons that have the same parent and owner belong to a single radiobutton group. If a radiobutton that was not previously selected is clicked, it changes to the "selected" state and the previously selected radiobutton is reset to the "not selected" state. The XbpStatic dialog element is generally used to draw a box around the radiobuttons and is used as the parent and owner for the radiobutton group. This allows the radiobuttons to be visually grouped and multiple radiobutton groups to be placed in a single window.

Class methods
:new()
Creates an instance of the XbpRadioButton class.
Configuration

The instance variables in this group configure system resources. If changes are made to these values, they must either be made before the :create() method is executed or the :configure() method must be used to activate the changes.

:autoSize
Automatically fits the size of the radiobutton to the caption.
:caption
The caption of the radiobutton.
:pointerFocus
Indicates whether the radiobutton receives input focus when the mouse is clicked on it.
:selection
The state of the XbpRadioButton object.
Life cycle
:create()
Requests system resources for the XbpRadioButton object.
:configure()
Reconfigures the XbpRadioButton object after :create() has been executed.
:destroy()
Releases the system resources of the XbpRadioButton object.
Manipulation
:editBuffer()
Returns the value in the edit buffer of the radiobutton.
:getData()
Returns the current state of the radiobutton.
:setCaption()
Specifies a new caption.
:setData()
Sets the current value or state of the radiobutton.
Messages
xbeP_Selected
Radiobutton has been selected.
Examples
Selection using radiobuttons

// The example demonstrates the basic process 
// for creating radiobuttons. An XbpStatic 
// object is used as the parent (this is also 
// the owner by default) to combine the four 
// radiobuttons into one group. 

#include "Xbp.ch" 
#include "Appevent.ch" 

PROCEDURE Main 
   LOCAL nEvent, mp1, mp2, oXbp 
   LOCAL oStatic, oRadio, bSelected 

   SetColor( "N/W" ) 
   CLS 

   // XbpStatic to act as parent and owner of the radiobuttons 
   oStatic         := XbpStatic():new( ,, {200,120}, {120,150} ) 
   oStatic:type    := XBPSTATIC_TYPE_GROUPBOX 
   oStatic:caption := "COM Ports" 
   oStatic:create() 

   // Display which radiobutton is selected 
   bSelected := {|mp1,mp2,obj| QOut( obj:caption ) } 

   // Create four radiobuttons 
   // ( Owner == Parent == oStatic ) 
   oRadio := XbpRadioButton():new( oStatic,, {20,100}, {80,20} ) 
   oRadio:caption   := "COM 1" 
   oRadio:selection :=.T. 
   oRadio:selected  := bSelected 
   oRadio:create() 

   oRadio := XbpRadioButton():new( oStatic,, {20,70}, {80,20} ) 
   oRadio:caption   := "COM 2" 
   oRadio:selected  := bSelected 
   oRadio:create() 

   oRadio := XbpRadioButton():new( oStatic,, {20,40}, {80,20} ) 
   oRadio:caption   := "COM 3" 
   oRadio:selected  := bSelected 
   oRadio:create() 

   oRadio := XbpRadioButton():new( oStatic,, {20,10}, {80,20} ) 
   oRadio:caption   := "COM 4" 
   oRadio:selected  := bSelected 
   oRadio:create() 

   nEvent := 0 
   DO WHILE nEvent <> xbeP_Close 
      nEvent := AppEvent( @mp1, @mp2, @oXbp ) 
      oXbp:handleEvent( nEvent, mp1, mp2 ) 
   ENDDO 
RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.