Class: ComboForm

Properties  Events  Methods    Index of Classes

Combines the functionality of the form class with that of a standard Windows drop-down list



Library: Windows Application Class Library

Package: Windows.pkg

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


The ComboForm combines the functionality of the form class with that of a standard Windows drop-down list. This class is used when it is appropriate to supply a form with a list of static options. Both drop-down and drop-down edit functionality is supported. This class is used for simple, non-database entry.

The dbComboForm class is a data-aware version of the ComboForm class.


Use Windows.pkg

Object Field1 is a ComboForm
    Set Size to 13 100
    Set Location to 10 70
    Set Label to "User Name:"
    Set Combo_Sort_State to False
    Procedure Combo_Fill_List
        Send Combo_Add_Item "John"
        Send Combo_Add_Item "Susan"
        Send Combo_Add_Item "Michael"
Object Field2 is a ComboForm
    Set Size to 13 100
    Set Location to 25 70
    Set Label to "Department:"
    Set Entry_State to False

    Procedure Combo_Fill_List
        Send Combo_Add_Item "Research"
        Send Combo_Add_Item "Accounting"
        Send Combo_Add_Item "Support"
        Send Combo_Add_Item "Marketing"


Use Windows.pkg
Object oObjectName is a ComboForm
    Set Size to height width
    Set Location to row column
    Set ListRowCount to Rows
    Set Value 0 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_Margin 0 to number
    Set Enabled_State to true|false
    Set Status_Help to text
    Set Entry_State to true|false
    Set Combo_Sort_State to true|false
    Procedure Combo_Fill_List
        : (add combo items by sending Combo_Add_Item)
    Procedure OnChange
    Procedure OnSetFocus
    Procedure OnKillFocus

Of Special Note

The ComboForm class is descended from the Form class and therefore, except where noted, inherits all of the properties and capabilities of the Form class. While there are many new messages provided for this class, its expected usage is quite simple. You use it just like form class except that a combo list must be filled (Combo_Fill_List and Combo_Add_Item). This list may or may not be sorted (Combo_Sort_State). Setting Entry_State determines if the form supports keyboard editing or incremental search.

ComboForm Height and Vertical Label Location

The height of a ComboForm (or dbComboForm) is more or less fixed by Windows, so you could technically set the height to be anything and the combo form itself would look the same. e.g.

Set Size to 13 95
Set Size to 60 95

The two lines of code above would produce a combo form that looks identical.

However, the Label (Label_Object) of a combo form is positioned to be centered with the height, so we recommend keeping the height always at 13 for consistent label height centering.

If you must set a different height, you can set the Label_Row_Offset to determine the label's vertical location.

Set Label_Row_Offset to 1

The Form Component

A ComboForm really consists of two components, a form and a list. The form behaves exactly like a standard form. It is single-item and supports the standard single-item interface. The item number will always be item 0 and does not have to be passed.

The contents of the form are 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 with the get and set value messages (get/set value 0 to val). Any time the contents of a Form are changed (through keyboard input, list selection, or by set value message) the event message OnChange is sent. Also, if users enter any change to the window, the Item_Changed_State and the Changed_State of the object are set true.

The Entry_State of the form determines how keyboard interaction is handled. When true (the default), normal entry is allowed into the form. This is referred to as a drop-down edit list. When set to false, the value in the form must match a value from the list and a keyboard action performs an incremental search. This is referred to as a drop-down list. The search method is determined by Windows (the ComboForm uses a standard Windows control).

The Size of a ComboForm

The height of the form component is determined by Windows and is 13 dialog units. This cannot be changed. The maximum height of the list is determined by the ListRowCount property and defaults to 10. Therefore the actual height you enter when setting the size property does usually not matter because it will be set by the by the object using ListRowCount. It is normally set to 13, making it easy to convert Forms into ComboForms without having to remember to change the size property.

The List Component

When a ComboForm object is created, an internal list object is created. This list's object ID is stored in the Combo_Data_Object property. This list is used only for storage. When a ComboForm is paged, the contents of this list is copied to the form's drop-down list.

A public message interface is supported to control this internal list. Most of these messages are prefixed with "combo_" (e.g., Combo_Fill_List, Combo_Add_Item, Combo_Delete_Item, Combo_Value, Combo_Item_Matching) When working with ComboForms, you should use these messages and avoid sending messages directly to the Combo_Data_Object list object.

Combo_Sort_State specifies if the items in the list should be sorted. When true, the default, the list is sorted. The internal list is never sorted. This means that the items in the internal list may not be in the same order as the items in the displayed list.


This class supports object shadowing. Objects of this class can either be explicitly shadowed (set Enabled_State) or shadowed implicitly when an ancestor object is shadowed. When shadowed, access to the drop-down list is disabled.


The ComboForm does not support masking.


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.