Class Xbp3State() Foundation

Class function of the Xbp3State class.


The Xbp3State class provides a dialog element that is similar to a checkbox but recognizes three states: selected, not selected and undefined. The current state is stored as a numeric value in the edit buffer of the three state button.

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

Class methods
Creates an instance of the Xbp3State class.

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.

Automatically fit the size of the three state button to the caption.
The caption of the three state button.
Indicates whether the three state button receives input focus when the mouse is clicked on it.
The state of the Xbp3State object.
Life cycle
Requests system resources for the Xbp3State object.
Reconfigure Xbp3State object after :create() has been executed.
Releases the system resources of the Xbp3State object.
Returns the value in the edit buffer of the three state button.
Returns the current state of a three state button.
Specifies a new caption.
Sets the current value or state of a three state button.
Three state Button is selected.

// In the example, two three state buttons are created that 
// output text in an XbpCrt window using QOut() when they are 
// "selected". Part of the displayed text is stored in an array. 

#include "" 

   LOCAL nEvent, mp1, mp2, oXbp 
   LOCAL aState := {"not selected", "selected", "undefined"} 

   // Create first 3State button, passing the position to :create() 
   oXbp := Xbp3State():new() 
   oXbp:caption := "A" 
   oXbp:create( , , {10,20}, {100,40} ) 

   // Determine current state using mp1 
   oXbp:selected := ; 
      {| mp1, mp2, oBtn| QOut( "3State A", ; 
                         aState[ mp1+1 ] ) } 

   // Create second 3State Button, passing the position to :new() 
   oXbp := Xbp3State():new( , , {150,20}, {100,40} ) 
   oXbp:caption := "B" 

   // Determine current state using :getData() 
   oXbp:selected := ; 
      {| mp1, mp2, oBtn|  QOut( "3State B", ; 
                        aState[ oBtn:getData()+1 ] ) } 

   // Event loop = Program control 
   nEvent := 0 
   DO WHILE nEvent <> xbeP_Close 
      nEvent := AppEvent( @mp1, @mp2, @oXbp ) 
      oXbp:HandleEvent( nEvent, mp1, mp2 ) 

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.