5. Events : ChildDetails Event
 
Share this page                  
ChildDetails Event
The ChildDetails event is triggered for a composite field when a child field receives the Details event.
This event has the following syntax:
on childdetails [compositefieldname]
compositefieldname is optional if you specify the event in a 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 ChildDetails event block:
TriggerField
Specifies the child field that the user clicked using the Shift+secondary mouse button
OriginatorField
Specifies the composite field specified in the initial on childdetails statement
SelectedList
Specifies the set of fields that are currently selected within the frame as a whole
To access these attributes, use the CurFrame system variable of the FrameExec class (see FrameExec Class).
Usage: The ChildDetails 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 ChildDetails event is triggered when the user uses the Shift+secondary mouse button to click any field in the frame.
The ChildDetails event block can be used to:
Detect when the user clicks the Shift+secondary mouse button on a row of table fields and then processes the user's selection.
For example, if the primary mouse button allows a user to select a highlighted row, you could use the Shift+secondary mouse button to let the user edit the row.
The following event block calls the EditRow frame when the user clicks the Shift+secondary mouse button on the highlighted row of the testtable table field:
on childdetails testtable =
begin
/*   The "current" row reflects the row that is
**   currently highlighted. CurFrame.TriggerField
**   is not necessarily the same as the CurRow of
**   the tablefield
*/
if field(testtable).CurRow > 0 then
   callframe EditRow
      (name = testtable[].Object_name);
else
   /* No row was currently highlighted */
   ...
endif;
end
Reduce coding.
For example, assume your form has two image trim fields and you want to call a general details function when the user clicks either field using the Shift+secondary mouse button. You could specify a Details event block for each:
on details image1 =
begin
callframe PictureDetails(fieldname =
'image1');
end

on details image2 =
begin
callframe PictureDetails(fieldname =
'image2');
end
Alternatively, to save code, you can place the image trim fields in a named composite field (a subform, flexible form, matrix field, or stack field) and specify one ChildDetails event for the composite field. For example, assume that you have placed the two image trim fields in a subform called picture_subform and have defined the following event block for that subform:
on childdetails picture_subform =
begin
callframe PictureDetails(fieldname =
CurFrame.TriggerField.Name);
end
When the user clicks the Shift+secondary mouse button on either image trim field, OpenROAD executes the event block. In this example, the TriggerField attribute of the FrameExec object specifies which field actually triggered the event (the image that was under the mouse when the user clicked).
However, if the user draws a drag box to select one or more fields and then clicks the Shift+secondary mouse button, the TriggerField attribute is set to the field that was under the cursor when the Shift+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 Details event block for a field and a ChildDetails event block for one or more of the enclosing composite fields for the field. OpenROAD then executes the event blocks from the innermost to the outermost fields as described in Event Block Execution (see Event Block Execution) under ChildClick event.
More information:
OriginatorField Attribute (see page OriginatorField Attribute)
SelectedList Attribute (see page SelectedList Attribute)
TriggerField Attribute (see page TriggerField Attribute)