Book a Demo

Author Topic: addsubshape syntax for layouttype=border  (Read 5908 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
addsubshape syntax for layouttype=border
« 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
« Last Edit: May 09, 2018, 05:12:52 pm by Paolo F Cantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: addsubshape syntax for layouttype=border
« Reply #1 on: May 10, 2018, 03:01:48 am »
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=

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: addsubshape syntax for layouttype=border
« Reply #2 on: May 10, 2018, 10:57:45 am »
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
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: addsubshape syntax for layouttype=border
« Reply #3 on: May 10, 2018, 04:33:07 pm »
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


Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: addsubshape syntax for layouttype=border
« Reply #4 on: May 11, 2018, 11:03:16 am »
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
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: addsubshape syntax for layouttype=border
« Reply #5 on: May 11, 2018, 11:36:08 am »
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.
The Sparx Team
[email protected]

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: addsubshape syntax for layouttype=border
« Reply #6 on: May 11, 2018, 03:39:39 pm »

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
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: addsubshape syntax for layouttype=border
« Reply #7 on: May 11, 2018, 03:44:56 pm »
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.
The Sparx Team
[email protected]

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: addsubshape syntax for layouttype=border
« Reply #8 on: May 11, 2018, 03:47:07 pm »
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
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!