Skip to content

Form_Margin - DfBaseForm

Defines the maximum number of characters that can be typed into a data-entry field

Type: Property
Access: Read/Write
Data Type: Integer
Parameters: None

Parameters

Parameter Type Description
iItem Integer

Syntax

Property Integer Form_Margin
Access Type Syntax
Read Access: Get Form_Margin to IntegerVariable
Write Access: Set Form_Margin to IntegerVariable/Value

Description

Form_Margin defines the maximum number of characters that can be typed into a data-entry field. If the number of characters is greater than the display area, the object will horizontally scroll left or right to accommodate the cursor. This is set by default to the width of the field addressed unless the item enters to a variable or expression, in which case it is set by default to 100.

ComboForm and dbComboForm Classes

In the combo-classes (ComboForm and dbComboForm), Form_Margin will not necessarily limit the exact number of characters specified, it depends on the font used. Instead, you can call Windows message CB_LIMITTEXT:

Procedure Page Integer iPageObject
    Integer iRetVal iFormMargin

    Forward Send Page iPageObject

    move 10 to iFormMargin
    Get Windows_Message CB_LIMITTEXT iFormMargin 0 to iRetVal
End_Procedure

In the dbComboForm class, you can call set the first parameter sent to Windows message CB_LIMITTEXT to Form_Margin, which is typically set by the Data Dictionary Server of the DEO:

Object oComboForm1 is a ComboForm
    // CBS_AUTOHSCROLL must be set to True for CB_LIMITTEXT to work
    Set Window_Style CBS_AUTOHSCROLL to True

    Procedure Page Integer iPageObject
        Integer iRetVal iFormMargin

        Forward Send Page iPageObject

        get Form_Margin to iFormMargin
        Get Windows_Message CB_LIMITTEXT iFormMargin 0 to iRetVal
    End_Procedure
End_Object