Skip to content

Object Creation Preferences

Each class can have an associated preference file (classname.dfo). This file can be used to set properties, add custom source code, or create additional child objects. When a new object is created by the Studio, the object’s preference file is processed and added to the object. These optional preference files are located in the \Pkg\Config folder (for the system library, these files are read-only) and in the \AppSrc\Config folder for workspace augmentations and subclasses. They are given the same name as their class with a file extension of .dfo. For example, a Button preference class would be named button.dfo. These files look like standard DataFlex source code.

The system class library has many preference files in place.

Examples

Here are some examples of how object creation preferences are used.

Button.dfo

When a button class is created, we use this file to automatically create a template OnClick procedure. When you drop the object and view the source, you will see the following code already in place:

Procedure OnClick
    ...
End_Procedure

Grid.dfo

When a Grid is dropped into a Component, the grid will be created with three columns labeled Column 1, Column 2, and Column 3.

RadioGroup.dfo

When a RadioGroup object is created, it will automatically create three radio child objects labeled Radio Label 1, Radio Label 2, and Radio Label 3. In addition, it will create a template Notify_Select_State procedure. When you drop the object and view the source, you will see the following code already in place:

Procedure Notify_Select_State integer iToItem integer iFromItem
    // for augmentation
End_Procedure

See Also

Studio Concepts