Object

See Also: Object Declaration, Class, End_Object, Naming Conventions

Purpose

To create an object instance of a class.

Syntax

Object {object-name} is a {object-class}

    …

End_Object

Where {object_name} may be between 1 and 4096 characters in length, must start with a letter, and may not contain spaces. Recommended characters are 0-9, a-z, A-Z and _ (underscore).

What It Does

Each object used by a running program must be created either by the object command or dynamically using the Create function. Object definition blocks are terminated with the End_Object command. Each object is identified by a user supplied name (object-name).

Example

Object oCustomer_Number is a dbForm

    Entry_Item Customer.Customer_number

 

    Set Label to "Customer Number:"

    Set Size to 13 42

    Set Location to 5 72

    Set peAnchors to anTopLeft

    Set Label_Col_Offset to 2

    Set Label_Justification_Mode to jMode_Right

End_Object

 

Example

Object oOK_bn is a Button

    Set Label to "&Ok"

    Set Location to 116 228

    Set peAnchors to anBottomRight

 

    Procedure OnClick

        Send OK To oSelList

    End_Procedure

 

End_Object

 

Object-class must be the name of one of the DataFlex-supplied or user-defined object classes. The remainder of the object definition command line is actually class dependent.

Objects inherit messages, procedures, functions, properties, and creation syntax from their class.

When functions, procedures, properties, On_Key statements and other objects are included within an object definition block, the resultant components are local in scope to Object object-name. An object defined in a block that is itself nested in another object definition block is said to be the child of the surrounding object, and the parent property of the child object acquires the value of the id of the surrounding (parent) object.

Throughout an object definition block (except for the interiors of the object definition blocks of child objects), the value of Integer Self is the id of Object object-name. This applies at runtime for procedures and functions within object-name's object definition block.

A child object acquires accelerator key assignments from its parent object through delegation, except where any of these components is overridden by a new definition (via On_Key) within the child. Objects can send messages to their child objects by use of the broadcast command.

Object Names

While object names do not have to be unique, it is desirable for typical components designed in the Studio (e.g. Views) that make up object neighborhoods to contain child objects with unique names. Having multiple objects in the same object neighborhood with the same name can cause hard to detect runtime issues to occur. The Studio will attempt to create unique object names when creating objects for you (e.g. with a wizard or via drag and drop).

No object created within a given class creation block may have a name matched by another object created in the same block.