Book a Demo

Author Topic: Sub-shape with 2 parms in shape script  (Read 4551 times)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Sub-shape with 2 parms in shape script
« on: January 16, 2014, 06:29:15 am »
Someone getting sick of this? Well, I am...

I tried to use sub-shapes with 2 parameters where layoutType="border". It seems that only "N" and "CENTER" produce results, both being the same. Using "S" shows some strange result in the preview, but none at all on the real diagram.

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Sub-shape with 2 parms in shape script
« Reply #1 on: January 16, 2014, 10:09:31 am »
Again, it's used in BPMN. If using Border you MUST specify a default height/width.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Sub-shape with 2 parms in shape script
« Reply #2 on: January 16, 2014, 10:11:53 pm »
Again: no!
Code: [Select]
shape main {
      layouttype = "border";
 h_align = "left";
      noshadow = "true";
      DefSize(200,100);
      setfillcolor(0,0,255);
 rectangle(0,0,100,100);
 addsubshape("sub","s");
 shape sub {
  setfillcolor(0,255,0);
  ellipse(10,10,90,90);
 }
}
"n" and "center" place it in the center. Just see what "s" produces :-(

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Sub-shape with 2 parms in shape script
« Reply #3 on: January 17, 2014, 08:48:49 am »
Here's a tip. I am trying to help you. It's not my job to look up the help for you. But you could find the answer in the sub-shapes topic.

Quote
  • 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

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Sub-shape with 2 parms in shape script
« Reply #4 on: January 17, 2014, 10:53:09 am »
I really appreciate what you do, Simon. And you are right: I missed this sentence right below (probably it should be part of the Border paragraph, not one on its own). However, have a look at this example:
You see the preview? Not exactly what the final shape looks like (try omitting either the "S" or "N" and see what happens then). Now further I would expect either of them to occupy only the 50 units, not something like 75.

q.