5. Events : ChildSelect Event
 
Share this page                  
ChildSelect Event
The ChildSelect event is triggered for a composite field when a child field receives the Select event.
This event has the following syntax:
on childselect [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 ChildSelect event block:
TriggerField
Specifies the field that the user selected
OriginatorField
Specifies the composite field specified in the initial on childselect statement
SelectedList
Specifies a list of currently selected fields in the frame.
Use the CurFrame system variable to access these attributes. For more information, see FrameExec Class (see FrameExec Class).
Usage: The ChildSelect 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 ChildSelect event is triggered when a Select event occurs on any field that is set to one of the select biases.
The ChildSelect event can be used when the user selects a child field or shape. This event is used in visual editor applications that provide some type of a composite field canvas (usually a subform) on which the user can manipulate shapes or fields. Workbench's Frame Editor uses the ChildSelect event. In this application, fields, or shapes are set to select biases, and the user can move and resize objects on the screen using mouse drags.
For example, the following code lets the user interactively select, move, and resize shapes. The following ChildSelect event block tracks the screen locations of selected fields:
on childselect test_subform,
on childmoved test_subform,
on childresized test_subform =
begin
/*  The GetAttribute method can be used, with
**  a byref set of parameters to get attribute
**  values for any type of object. In this
**  example, the coordinates of the bounding box
**  resized will be placed in the simple
**  fields called startx, starty, endx and endy
*/
CurFrame.TriggerField.GetAttribute(
XLeft = byref(startx),
YTop = byref(starty),
XRight = byref(endx),
YBottom = byref(endy)
);
end
Test_subform is the canvas on which the user creates and manipulates the shapes. When the user selects a shape, this block executes, to store the screen location coordinates of the selected shape. It also executes when the user moves or resizes the selected shape.
You can specify a Select event block for a field and a ChildSelect 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).
Note:  When the user selects a group of fields, as is done in the Workbench Frame Editor with the drag box (when the Frame Editor is in a mode where selections are allowed), a ChildSelect event is triggered for each selected field. To get a single event each time a set of selected object changes in any way, use the special SelectionChanged event for the frame.
More information:
OriginatorField Attribute (see page OriginatorField Attribute)
SelectedList Attribute (see page SelectedList Attribute)
TriggerField Attribute (see page TriggerField Attribute)