Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.
Sub-Shapes
Shapes can contain - and be composed of - other shapes.
Subshape Layout:
To set the layout type, the layoutType attribute must be set in the initialization attributes section of the script; in other words, before any of the methods are called. Valid values for this attribute are:
• | LeftRight - Shapes with leftright layout position subshapes side by side, with the first added on the left, and subsequent subshapes to the right |
• | TopDown - TopDown places subshapes in a vertical arrangement, with the first shape added to the top and subsequent shapes added below |
• | Border - Border layout requires an additional argument to the addsubshape method to specify which region of the containing shape the subshape is to occupy: N, E, S, W or CENTER; each region can only be occupied by one subshape A subshape that is assigned to the E or W region must have its preferredwidth attribute specified in its declaration and, similarly, subshapes added to N or S must have their preferredheight attribute set; in this case, the values for these attributes are treated as static lengths and do not scale glyphs |
For example:
shape main
{
layouttype="topdown";
setfillcolor(0,0,255);
rectangle(0,0,100,100);
addsubshape("sub",50,100,20,0);
addsubshape("sub",50,100,30,-100);
addsubshape("sub",50,100,40,-200);
addsubshape("sub",50,100,50,-300);
shape sub
{
setfillcolor(0,255,0);
ellipse(0,0,100,100);
}
}
The above script provides the following shape:
The material ("material" includes all pages, documents and on-line graphics) on this web site is protected by copyright law. (C) 1998-2011 Sparx Systems Pty Ltd.