Class: Form

Properties  Events  Methods    Index of Classes

To display and accept keyboard input



Library: Windows Application Class Library

Package: Windows.pkg

Mixins: Standard_Form_Mixin Prompt_Button_Mixin ToolTip_Support_Mixin cPlaceholders_Mixin Standard_Object_Mixin Dflabel_Mixin Single_Item_Navigate_Mixin Mask_form_Mixin FloatingPopupMenu_Mixin RGB_Support_Temp_Mixin Help_Mixin Shadow_Mixin


The Form class is used to display and accept keyboard input. This class can be used for all non-database entry needs.

The dbForm class is a data-aware class similar to the Form class. For most uses, the dbForm class is the preferred option, even when used as a non-data-aware form.


Use Windows.pkg

Object Field1 is a Form
    Set Size to 13 100
    Set Location to 10 70
    Set Label to "User Name:"
    Set Value to "Guest"

Object Field2 is a Form
    Set Size to 13 50
    Set Location to 25 70
    Set Label to "User Id:"
    Set Form_Margin to 20
    Set Capslock_State to True

    Function User_Id returns String
        string sId
        Get Value to sId
        Function_Return sId 


Use Windows.pkg

Object oObjectName is a Form
    Set Size to height width
    Set Location to row column
    Set Value to value

    Set Label to text
    Set Label_Justification_Mode to mode
    Set Label_Row_Offset to Num
    Set Label_Col_Offset to Num

    Set Form_DataType to mode
    Set Form_Margin to mode
    Set Form_Mask to MaskString
    Set Numeric_Mask to leftDigits rightDigits {template}
    Set Currency_Mask to leftDigits rightDigits {template}

    Set Capslock_State to true| false
    Set Enabled_State to true| false
    Set Status_Help to text

    Procedure OnChange

    Procedure OnSetFocus

    Procedure OnKillFocus


Of Special Note

The Form class is descended from the DfBaseForm class and therefore inherits all of the properties and capabilities of that class. It has been extended to support help, status help display, item masking, object shadowing, and label display. It is expected that you will use this class (and not DfBaseForm) for your simple non-database entry needs.

This class will be used for single item entry. The item number will always be item 0 and does not have to be passed.

The Value of a Form

The contents of a form is stored in its value property. When a Form-class object has the focus it will accept data from the keyboard directly into the value of the item. The value can also be directly changed and retrieved using Value. Any time the contents of a Form are changed (through keyboard or by setting Value), the OnChange event is sent. Also, if users enter any change to the window, the Item_Changed_State and the Changed_State of the object are set to True.


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 whenever the object's Enabled_State property is False.


This class supports input and display masking for a variety of data types (text, numeric, currency, and dates). The type of masking used is determined by the object's Form_DataType (which supports both masked and non-masked types) and the object's Form_Mask. Two additional messages, set Currency_Mask and set Numeric_Mask, make it particularly easy to define currency and numeric data types and fields with a single message.


Forms often require an associated description or label. Most-often, these appear to the left of the form. Labels are supported with the set Label message. The default location and justification mode of labels can be controlled with the properties Label_Col_Offset, Label_Row_Offset and Label_Justification_Mode.

Prompt Buttons

This class automatically supports prompt buttons. If a prompt object is defined for this object, a prompt button will appear automatically in it. When the button is pressed, the prompt message will be sent and a prompt object (usually a selection list) will appear. Prompt objects are usually acquired from the data-dictionary object, but may be explicitly defined by setting the Prompt_Object property.

If you do not want automatic prompt-button creation, this feature may be disabled by setting the property Prompt_Button_Mode to PB_PromptOff. A prompt button may be explicitly created by setting the Prompt_Button_Mode property to PB_PromptAuto.