5. Events : ChildProperties Event
 
Share this page                  
ChildProperties Event
The ChildProperties event is triggered for a composite field when the user uses the secondary mouse button to click a child field.
This event has the following syntax:
on childproperties [compositefieldname]
compositefieldname is optional if you specify this event in a field script for a composite field, or if the composite field is the frame's top form.
The following attributes of the FrameExec class can be used in the ChildProperties event block:
TriggerField
Specifies the field on which the user clicked using the secondary mouse button
OriginatorField
Specifies the composite field specified in the initial on childproperties statement.
Use the CurFrame system variable to access these attributes. For more information about this variable, see FrameExec Class (see FrameExec Class).
Usage: The ChildProperties event is defined for all composite fields, including the subform that is the frame's top form. If you specify this event in the frame script without a composite field name, the ChildProperties event is triggered when the user clicks the secondary mouse button while the mouse is positioned over any field in the frame.
The ChildProperties event can be used with table fields to allow processing to occur whenever the secondary mouse button is clicked within the table field. If you define a ChildProperties event for a table field, the event block is triggered each time the user clicks the secondary mouse button on a highlighted row. (The bias of the table field should be FB_LANDABLE.) You can use this event block to call another frame or perform an operation on the values in the row.
For example, assume that your form contains a table field, testtable, which displays an array and is set to a bias of FB_LANDABLE. When the user clicks the secondary mouse button on a highlighted row, you want to call the RowProperties frame. You could use the following code:
on childproperties testtable =
begin
/*  CurFrame.TriggerField will not necessarily be
**  the same as the CurRow of the tablefield
**  because clicking with the properties button
**  will not automatically change the CurRow of
**  the table field
*/
if field(testtable).CurRow > 0 then
callframe RowProperties(name =
         testtable[].Object_name);
else
/* No row is highlighted in the table field */
...
endif;
end
If the operations in the ChildProperties event block are the same for all the fields on a form, you can use one event block for all fields by placing the event block in the frame script and not specifying a composite field name in its syntax.
For example, assume that you have a form with two ImageTrim fields (image1 and image2) and you want to call a general properties function for the picture currently under the cursor. You could use separate event blocks for each field to perform this task:
on properties image1 =
begin
callframe PictureProperties(fieldname = 'image1');
end

on properties image2 =
begin
callframe PictureProperties(fieldname = 'image2');
end
Alternatively, you can accomplish the same behavior with less code by using one ChildProperites event block in the frame script:
on childproperties =
begin
callframe PictureProperties
(fieldname = CurFrame.TriggerField.Name);
end
This event block is executed when the user clicks the secondary mouse button while the cursor is on any field on the form (if the field has a select or draw bias). In this case, the TriggerField attribute of the FrameExec object represents the field that actually triggered the event (the image on which the user clicked).
If the user selects one or more fields using a drag box and then clicks the secondary mouse button, the TriggerField attribute is set to the field that was actually under the cursor when the secondary mouse button was clicked (which cannot be any of the selected fields). To process the selected fields, use the SelectedList attribute of the FrameExec object, rather than the TriggerField attribute.
You can specify a Properties event block for a field and a ChildProperties event block for one or more of the enclosing composite fields for the field. OpenROAD executes the event blocks as described in Event Block Execution (see Event Block Execution).
More information:
OriginatorField Attribute (see page OriginatorField Attribute)
TriggerField Attribute (see page TriggerField Attribute)