Class: CheckBox

Properties  Events  Methods    Index of Classes

To enable users to select items (or options) in applications

Hierarchy

cObject
---cUIObject
------DfBaseObject
---------DfBaseWindow
------------DfBaseUIWindow
---------------DfBaseControl
------------------DfBaseList
---------------------DfBaseButton
------------------------DfBaseCheckbox
---------------------------CheckBox

Library: Windows Application Class Library

Package: Windows.pkg

Mixins: Standard_Select_Mixin Bitmap_Support_Mixin ToolTip_Support_Mixin Standard_Object_Mixin Single_Item_Navigate_Mixin Select_Mixin RGB_Support_Temp_Mixin Help_Mixin Shadow_Mixin

Description

The CheckBox class is used to select items (or options) in applications. A CheckBox appears as a square box with text (usually located to the right of the check box). The checked_state of the check box may be toggled on or off by placing the cursor on it and pressing a key or clicking it with the mouse or by directly setting this property. The appearance of the box indicates at all times whether it is selected.

The dbCheckBox class is a data-aware class similar to the CheckBox class.

Sample

Object oCheck1 is a CheckBox 
    Set Location to 10 5
    Set Label to "Show All Detail"
    Set Checked_State to True
End_Object

Function ShowDetail returns Boolean
    Boolean bState
    Get Checked_State of check1 to bState
    Function_Return bState
End_Function

Object FileName_Form is a Form
    Set Location to 25 65
    Size Size to 13 100
    Set Label to "File name:"
End_Object

Object oCheck2 is a CheckBox 
    Set Location to 40 5
    Set Label to "Print to File"
    Set Checked_State to True

    // Shadow file name form is print to file is false
    Procedure OnChange
        Boolean bState
        Get Checked_State to bState
        Set Enabled_State of oFileNameForm to bState
    End_Procedure
End_Object



Syntax

Use Windows.pkg

Object object_name is a CheckBox
    Set Location to row column
    Set Label to text
    Set Checked_State to true|false
    Set Enabled_State to true|false
    Set Status_Help to text

    Procedure onChange
        :
    End_Procedure

    Procedure onSetFocus
        :
    End_Procedure

    Procedure onKillFocus
        :
    End_Procedure
End_Object


Of Special Note

This class is a subclass of the DfBaseCheckbox class and therefore inherits all its properties and capabilities. It has been extended to support help, status-help display, object shadowing, and label display. It is expected that you will use this class for your simple non-database checkbox entry needs. Data-aware check boxes are supported in the dbCheckBox class.

There will be one single item (Item 0) per object of this class.

The Checked State of a Checkbox

The state of this object may be set and retrieved (get) with the checked_state property. This message actually uses the internal property select_state (for Item 0). When this object has the focus, users can toggle the checked_state property by pressing the spacebar or by clicking the mouse button. Any time the checkbox state is changed, the event message onChange is sent. Also, if users enter any change to the displayed text, the item_changed_state (of Item 0) and the changed_state of the object are set true.

Shadowing

Shadowing refers to the process of making an object or an item unavailable for data entry. Usually the appearance of a shadowed object is changed in some way to indicate its unavailability. This class supports object shadowing. Accordingly, objects of this class will be shadowed whenever an ancestor object is shadowed or when the object's enabled_state property is set false.

Labels

The label of this object refers to the text that will appear the right of this object. If you wish to show text to the left (similar to labels found on forms), you will need to create a separate TextBox for the text and leave the label of this object blank.

Auto-Sizing

The size of this object is determined automatically based on the size of its label text. This auto-sizing may be disabled by setting the auto_size_state property to false.