Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Paolo F Cantoni on May 09, 2018, 05:11:09 pm
-
From the help...
To set the layout type you use the layoutType attribute, which 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 this layout position the sub-shapes side by side, with the first added on the left, and subsequent sub-shapes to the right
- TopDown - Places the sub-shapes in a vertical arrangement, with the first sub-shape added to the top and subsequent sub-shapes added beneath
- Border - This requires an additional argument to the addsubshape method to specify which region of the containing shape the sub-shape is to occupy: N, E, S, W or CENTER; each region can only be occupied by one sub-shape
A sub-shape that is assigned to the E or W region must have its preferredwidth attribute specified in its declaration and, similarly, sub-shapes 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
Unfortunately, neither the Help file nor the editor tool-tip show the exact syntax to be used for the addsubshape method with layouttype=border
Can a Sparxian, please enlighten me?
Paolo
-
Paolo,
Here are a few example shapescripts that use layouttype=border:
I guess you should be able to deduct the proper syntax this way as well.
https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library/search?utf8=%E2%9C%93&q=layouttype%3Dborder&type= (https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library/search?utf8=%E2%9C%93&q=layouttype%3Dborder&type=)
Geert
-
Yes, I was aware of that syntax, but is that ALL you can do with it? This hinges on the word "additional". If this was the only variant for layouttype=border, I'd have expected different. Additional normally implies in addition to.
That's my question.
Paolo
-
I read it like:
This requires an additional argument to the addsubshape method
And indeed we see
addsubshape("triangle","center");
addsubshape("name","s");
That must be it no?
Geert
-
I read it like:
This requires an additional argument to the addsubshape method
And indeed we see
addsubshape("triangle","center");
addsubshape("name","s");
That must be it no?
Geert
No, the description is technically ambiguous I could read it that way, but I could (reasonably) read it differently. The absence of a formal syntax for that use case in BOTH the help system and the tooltip, makes it even more so.
FWIW, exactly such an ambiguity is what started me on this "modelling lark" four decades ago! (Blame it all on James Martin)
Paolo
-
I read it like:
This requires an additional argument to the addsubshape method
And indeed we see
addsubshape("triangle","center");
addsubshape("name","s");
That must be it no?
Geert
No, the description is technically ambiguous I could read it that way, but I could (reasonably) read it differently. The absence of a formal syntax for that use case in BOTH the help system and the tooltip, makes it even more so.
FWIW, exactly such an ambiguity is what started me on this "modelling lark" four decades ago! (Blame it all on James Martin)
Paolo
Geert is of course correct.
-
Geert is of course correct.
Yes, but he's not a Sparxian. I, too, have used the syntax he mentioned for many years, but I was secretly hoping there were more syntaxes where one could combine the location and sizing.
Paolo
-
For layouttype="border" there are two arguments: name and location. For other layout types, there are either one, three or five arguments: name, width, height, X position, Y position.
-
For layouttype="border" there are two arguments: name and location. For other layout types, there are either one, three or five arguments: name, width, height, X position, Y position.
Could you please get the help and editor tooltips updated to reflect that, please?
Paolo