4. Working with Classes : How You Can Manipulate Objects Generically: Casting : How You Can Work with Attributes : Other Attributes Commonly Used Generically
 
Share this page                  
Other Attributes Commonly Used Generically
The FrameExec system class defines several other attributes that facilitate generic code development:
InputFocusField
Contains the field on the form that currently has the input focus. The following example demonstrates changing the background pattern of the current field without knowing its name:
CurFrame.InputFocusField.BgPattern = FP_SHADE;
This example does not require casting because the data type of the InputFocusField attribute is ActiveField, and ActiveField is a subclass of the system class (FormField) for which the BgPattern attribute is defined.
OriginatorField
Contains the field defined in the on event statement that originated the specified event. For example, assume that you code a ChildExit event block for a composite field (On ChildExit CompField). Whenever the user exits any of the child fields composing CompField, the OriginatorField attribute contains the composite field name, CompField. In contrast, the TriggerField attribute contains the name of the specific child field that the user exited.
This attribute is particularly useful when you have multiple events defining the same event block. For example, if you have a radio field and menu list that you use to enable multiple interfaces to the same action and you want to keep them synchronized, you could use the following code:
on click TestRadioField,
on click TestMenuList =
begin
if CurFrame.OriginatorField =
    field(TestRadioField)then
    TestMenuList = TestRadioField;
else
    TestRadioField = TestMenuList;
endif;
/* common code goes here */
end;
TargetField
Contains the name of the field that will next have the input focus (assuming the focus is not moved)