Click or drag to resize

CheckBox Class

X#
Create check boxes, which are controls that can be toggled on or off by a user (or for 3-state check boxes, to a third state).
Inheritance Hierarchy
Object
  VObject
    Control
      TextControl
        Button
          CheckBox

Namespace:  VO
Assembly:  VOGUIClasses (in VOGUIClasses.dll) Version: 2.24 GA
Syntax
 CLASS CheckBox INHERIT Button
Request Example View Source

The CheckBox type exposes the following members.

Constructors
  NameDescription
Public methodCheckBox
Construct a check box.
Top
Properties
  NameDescription
Public propertyChecked
A logical value representing the current state of a check box. It is TRUE if the box is checked (or for 3-state check boxes, if it is in the third UNDETERMINED state), otherwise it is FALSE. The CheckBox:Checked assign also changes CheckBox:Value and CheckBox:TextValue. Also, if the CheckBox:Value is changed, CheckBox:ValueChanged is set to TRUE.
Public propertyTextValue
CheckBox:TextValue is initialized to FALSE on data windows, since the control contains no text.
(Overrides TextValue.)
Public propertyValue
CheckBox:Value contains TRUE if the check box is in the checked (ON) state or for 3-state check boxes, in the third UNDETERMINED state. It contains FALSE if it is in the unchecked state (OFF).
(Overrides Value.)
Top
Methods
  NameDescription
Public methodDestroy
Provide a method to de-instantiate a CheckBox object.
(Overrides Destroy.)
Top
Remarks
A check box allows the user to choose between 2 or 3 states. A 2-state check box allows a choice between a checked (ON) and unchecked (OFF) state. The choice is reflected in CheckBox:Value access, which may be TRUE or FALSE. A 3-state check box adds a third (UNDETERMINED) state, in which the box is dimmed. The third state is indicated by CheckBox:Value being TRUE and by CheckBox:ValueChanged (which is normally TRUE) being FALSE. A check box may be bound to a logical field in a server. Because of this, you can not directly bind a 3-state check box to a server; instead you must create a numeric or character field to store the 3-state information, and update it based on the status of the CheckBox:Value and CheckBox:ValueChanged accesses. The Window:ButtonClick() event handler responds to events in the check box. The default behavior of the event handler is to toggle the state of the check box. Typically, you would implement your own ButtonClick() event handler in which you first call the default handler to set the state of the buttons. For example:
X#
1METHOD ButtonClick(oControlEvent) CLASS MyWind
2SUPER:ButtonClick(oControlEvent)
3// Do something else
Examples
This example creates a check box on a dialog window and then checks it:
X#
1CLASS MyDialog INHERIT DialogWindow
2HIDDEN oCBNew AS OBJECT
3METHOD Init(oWindow,nResourceID) CLASS MyDialog
4SUPER:Init(oWindow,nResourceID)
5oCBNew := CheckBox{SELF,IDB_CHECKBOX}
6oCBNew:Checked := TRUE
7SELF:Show()
In Windows, check boxes are equivalent to a button with the BS_CHECKBOX style. The style BS_AUTOCHECKBOX is useful because the button is automatically checked and unchecked without any code being written in the system. They are normally specified in the resource entity like this:
X#
1RESOURCE IDD_ABOUT DIALOG 20,20,160,120
2STYLE WS_POPUP | WS_DLGFRAME
3BEGIN
4CHECKBOX "&Color" IDB_COLOR,10,20,40,12
5CHECKBOX "&Filled" IDB_FILLED,10,35,40,12
6CONTROL "&Auto",IDB_AUTO,"button", BS_AUTOCHECKBOX,10,65,40,12
7DEFPUSHBUTTON "OK" IDB_OK,64,80,32,14, WS_GROUP
8END
See Also

Reference