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.
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.
// 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 "Appevent.ch"
PROCEDURE Main
LOCAL nEvent, mp1, mp2, oXbp
LOCAL aState := {"not selected", "selected", "undefined"}
SetColor("N/W")
CLS
// 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"
oXbp:create()
// 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 )
ENDDO
RETURN
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.