Book a Demo

Author Topic: The position of an element will be not updated  (Read 3002 times)

robmir

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
The position of an element will be not updated
« on: July 30, 2007, 03:41:08 am »
Hey,

I want to get the position of an element:

Code: [Select]

EA.Diagram diag;
EA.DiagramObject diagObj;
Rectangle rectangle = new Rectangle();

diag = gEARepository.GetCurrentDiagram();
diagObj = (diag.SelectedObjects.GetAt(0)) as EA.DiagramObject;
rectangle.X = diagObj.left;
rectangle.Y = diagObj.top;


If I move an element to other position, diagObj will be not updated. I mean that I get always the same values, why?

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: The position of an element will be not updated
« Reply #1 on: July 30, 2007, 05:04:28 am »
Did you call Update() on the DiagramObject? Did you reload the diagram?

Obvious questions I know, but I managed to waste a few hours because I did neither.

David

PS: Note that you need to move the DiagramObject, not the Element. The element itself is independent of the diagram.
No, you can't have it!

thomaskilian

  • Guest
Re: The position of an element will be not updated
« Reply #2 on: July 30, 2007, 11:36:22 am »
Diagram operations are not saved to the DB. You need to call "save changes" (manually or via the COM method which name slipped my mind).

danielku15

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
  • Nobody is perfect and I'm a nobody :D
    • View Profile
Re: The position of an element will be not updated
« Reply #3 on: August 06, 2007, 05:04:31 am »
Save? Nothing easier than that:

Code: [Select]

C#:
gEARepository.SaveDiagram(diag.DiagramID);

Java:
gEARepository.SaveDiagram(diag.GetDiagramID());
CoderLine.net - The Online Coder Resource (comming soon)