Language Reference Guide : 5. Events : ChildResized Event
 
Share this page                  
ChildResized Event
The ChildResized event is triggered for a composite field after the user resizes one of its child fields that is set to a bias of FB_RESIZEABLE or FB_FLEXIBLE.
This event has the following syntax:
on childresized [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 ChildResized event block:
TriggerField
Specifies the field with a bias of FB_RESIZEABLE or FB_FLEXIBLE that the user resized
OriginatorField
Specifies the composite field specified in the initial on childresized statement.
Use the CurFrame system variable to access these attributes. For more information, see FrameExec Class.
Usage: The ChildResized 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 ChildResized event is triggered when a Resized event occurs on any field that is set to a bias of FB_RESIZEABLE or FB_FLEXIBLE.
The ChildResized event can be used when a user has resized a shape or field. 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 ChildResized event. In this application, fields or shapes are set to a bias of FB_RESIZEABLE or FB_FLEXIBLE, and the user can resize objects on the screen using mouse drags.
For example, the following code lets the user interactively move and resize shapes. Each time the user selects, moves, or resizes a shape, the following event block executes to store the new screen location coordinates of the shape:
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
**  for the field which was moved or 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 name of the composite field on which the user creates and manipulates shapes. The TriggerField is the field that was resized, thus triggering the event. The GetAttribute method obtains the coordinate values for the field's location. For more information, see GetAttribute Method.
You can specify a Resized event block for a field and a ChildResized 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.
More information:
OriginatorField Attribute
TriggerField Attribute