Class XbpCheckBox() Foundation

Class function of the XbpCheckBox class.

Superclass
Description

The XbpCheckBox class provides the checkbox dialog element. A checkbox is always in one of two conditions: "selected" or "not selected". The current state is stored in the edit buffer of the XbpCheckbox object. These states are identified by the logical values .T. (true) and .F. (false).

A checkbox is always displayed on the screen in two parts. It consists of a square where the current state of the checkbox is visually displayed and the caption which is displayed to the right of the box. The character "x" is displayed in the box when the checkbox is in the "selected" state. The appearance of this box cannot be altered. The caption displays the specified text and must be defined before the :create() method is called.

Class methods
:new()
Creates an instance of the XbpCheckBox 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 checkbox to the caption.
:caption
The caption of the checkbox.
:pointerFocus
Indicates whether the checkbox receives input focus when the mouse is clicked on it.
:selection
The state of the XbpCheckBox object.
Life cycle
:create()
Requests system resources for the XbpCheckBox object.
:configure()
Reconfigures the XbpCheckBox object after :create() has been executed.
:destroy()
Releases the system resources of the XbpCheckbox object.
Manipulation
:editBuffer()
Returns the value in the edit buffer of the checkbox.
:getData()
Returns the current state of the checkbox.
:setCaption()
Specifies a new caption.
:setData()
Sets the current value or state of the checkbox.
Events
:selected
Checkbox has been selected.
Examples
Create checkboxes
// In the example, two checkboxes are created in 
// an XbpCrt window. Each checkbox outputs text 
// using QOut() indicating whether it is "selected". 

#include "Appevent.ch" 

PROCEDURE Main 
   LOCAL nEvent, mp1, mp2, oXbp 
   SetColor("N/W") 
   CLS 

   // Create the first checkbox, specify position using :create() 
   oXbp := XbpCheckbox():new() 
   oXbp:caption := "A" 
   oXbp:create( , , {10,20}, {100,40} ) 

   // Determine state using mp1 
   oXbp:selected := ; 
      {| mp1, mp2, oChk| QOut( "Checkbox A", ; 
                     IIf( mp1, "selected" , ; 
                               "not selected" ) ) } 

   // Create second checkbox, specify position using :new() 
   oXbp := XbpCheckbox():new( , , {150,20}, {100,40} ) 
   oXbp:caption := "B" 
   oXbp:create() 

   // Determine state using :getData() 
   oXbp:selected := ; 
      {| mp1, mp2, oChk| QOut( "Checkbox B", ; 
          IIf( oChk:getData(), "selected", ; 
                               "not selected" ) ) } 

   // Event loop 
   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.