Class: Edit [Obsolete]

Properties  Events  Methods    Index of Classes

Allows users to enter multiple lines of text



Library: Windows Application Class Library

Package: Windows.pkg

Mixins: Standard_Object_Mixin Dflabel_Mixin Shadow_Mixin ToolTip_Support_Mixin RGB_Support_Temp_Mixin Help_Mixin


This class is obsolete. It has been replaced by the cTextEdit class.

Edit-class objects are general variable-length text editors. Applications use the Edit class to allow users to enter multiple lines of text.


Object Edit1 is an Edit
    Set Location to 10 15
    Set Size to 40 40
    Set Label to "Comments:"
Object Edit2 is an Edit
    Set Location to 60 15
    Set Size to 50 40
    Set Wrap_State to False // horizontal scroll support
    Set Label to "Source Listing:"
    Set Read_Only_State to True


Use windows
Object object_name is an Edit
    Set Size to height width
    Set Location to row column
    Set Label to LabelText
    Set Label_Justification_Mode to mode
    Set Label_Row_Offset to Num
    Set Label_Col_Offset to Num
    Set Status_Help to StatusHelpText
    Set Text_Limit to MaximumCharacters
    Set Wrap_State to true| false
    Set Enabled_State to true| false
    Set Read_Only_State to true| false
    Set Capslock_State to true| false
    Procedure onChange
    Procedure onSetFocus
    Procedure onKillFocus
    Procedure onMaxText


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 is explicitly set to false. When shadowed, the edit object cannot be entered (it will not take the focus).


It is often desirable to disallow modification of the contents of an edit area by users. The read_only_state will allow you to protect the contents of the buffer while still allowing users freedom to navigate. Shadowing disallows entry into the object. A read-only object may take the focus but will disallow changes.


Edits often require an associated description or label. Labels are supported with the set label message. By default, labels appear above the top left corner of the edit object. The location and justification mode of labels can be controlled with the properties label_col_offset, label_row_offset and label_justification_mode.

Position and Offset of the Caret

To find the position of the caret use the position function to return its row and column. To get the offset from the beginning of the buffer in bytes, use the current_offset function.

The position of the caret can be changed (thereby changing where data entry will occur) by using the move_absolute function or any of the navigation messages such as page_up or end_of_panel. These are described in the section "Procedures and Functions" below. It may be necessary to send the activate message to the control when the position is changed programmatically to redisplay the caret in the correct position.

The Current Selection

The current selection is displayed in inverse colors in the edit. It can be marked by dragging the mouse across the text or moving the arrow keys with the Shift key down. It can also be set programmatically using the select procedure and queried using the current_selection_range function. The current selection is often set as a side-effect of using navigation procedures such as move_absolute, so they shouldn't be used if there is a current selection.

Subclasses of Edit

The dbEdit class is a ready-made edit class designed to be used directly in data-entry applications. Generally, the dbEdit class is the best choice for applications.

Tab Function in Edit Objects

Tab stops can be set in an edit by using the tabstop property. By default, tab stops are set in 32-pixel increments, a spacing on average of 8 characters. The tabstop items are accessed exactly like an array. This is an example that changes the tab stops to 10-pixel increments:

Object oObjectName is an Edit
    set Size to 200 200
    set Location to 10 10
    set TabStop 1 to 20
    set TabStop 2 to 30
    set TabStop 3 to 40

Setting the tabstop for Item 0 will set default tabs for all items.

Object oObjectName is an Edit
    set Size to 200 200
    set Location to 10 10
    set TabStop 0 to 20  // tab stops every 20 dialog units.