Book a Demo

Author Topic: Problems doing layout of a diagram  (Read 3183 times)

Johan Too

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Problems doing layout of a diagram
« on: February 02, 2011, 03:27:49 am »
Hi I have code that is basically doing

foeach(obj in diagram.DiagramModels) {
        obj.left = x;
        obj.right = x + width;
        obj.top = y;
        obj.bottom = y + height;
        obj.Update();
}
diagram.Update();

the result is that all the diagram objects end up in the top left corner, except for a few that aren't... it isn't clear to me why this is happening or why a few do get a different position (and size).

If I run through the code a second time, the positions calculated by the logic are already in the left, right, top, bottom attributes, so it seems these are set correctly.

Any suggestions about what I am doing wrong?
« Last Edit: February 02, 2011, 03:31:54 am by jov »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Problems doing layout of a diagram
« Reply #1 on: February 02, 2011, 08:36:04 am »
What kind of values are you putting in?

Note, the y coordinates start at zero and move negative.  So unless your height variable is negative that is one error.

Johan Too

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Problems doing layout of a diagram
« Reply #2 on: February 02, 2011, 11:53:36 pm »
Hello Simon,

thank you for the reply!

Changing my height values to negative solved my problem :).

For completeness, the values are around 100 to 200 or so.