|
Using Formulas to Control Shapes
In ConceptDraw it became possible to program behavior of shapes, which is triggered by an event - such as repositioning the shape, resizing it, etc.
Events are specified in formulas, separated with a semicolon:
<formula>; <event1>; <event2>; <event3>
On event a formula is re-calculated and the contents of cells, referenced to by the formula, is updated.
Below is an example of how the program handles events. In the example there is a connector connected to two shapes.
The are the cells from the Glue Info section:
ConnectObjBegin |
1;ShapeID1.EventMove |
ConnectObjEnd |
2;ShapeID2.EventMove |
After the semicolon go the events on which the parameters will be re-calculated (when either of the shapes is moved). The parameters themselves - the IDs of the connected shapes - are not changed, however, other parameters in the EndPoints section are dependent on them.
BeginX |
_CONNECTBEGINX(ConnectObjBegin;ConnectObjEnd;ConnectTypeBegin) |
BeginY |
_CONNECTBEGINY(ConnectObjBegin;ConnectObjEnd;ConnectTypeBegin) |
EndX |
_CONNECTENDX(ConnectObjBegin;ConnectObjEnd;ConnectTypeEnd) |
EndY |
_CONNECTENDY(ConnectObjBegin;ConnectObjEnd;ConnectTypeEnd) |
These parameters include the parameters, to which the event is assigned and they will be re-calculated on that event.
Let's describe the events that exist in ConceptDraw.
Shape's Events.
The following events can be assigned to any ConceptDraw shape. They are specified in the formula in this form:
[<shape_name>.]<event_name>
Event |
Triggered When |
EventMove |
The shape is moved. |
EventResize |
The shape is resized. |
TextEventMove |
The shape's text box is moved. |
TextEventResize |
The shape's text box is resized. |
CharPropEvent |
The Character Properties section of the table or text formatting in shape are changed. |
Also, changing any variable in the parameter table can be an event. For instance, if after a semicolon you write <shape_name>.Width in a formula, the formula will be re-calculated only when the width of the specified shape is changed.
|