Book a Demo

Author Topic: DiagramObject.TextAlign  (Read 4722 times)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
DiagramObject.TextAlign
« on: August 27, 2016, 11:20:20 pm »
The help says
Quote
Indicates the alignment of text on a Note element on the diagram.
     1 = Left aligned
     2 = Center aligned
     3 = Right aligned
Defaults to 1 if an invalid value is supplied.
But it always returns 1 and can't be altered. Further: where could that be done with the GUI?

q.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: DiagramObject.TextAlign
« Reply #1 on: August 29, 2016, 09:42:59 am »
But it always returns 1 and can't be altered.
It reports the wrong value but setting it should work OK.
The Sparx Team
[email protected]

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: DiagramObject.TextAlign
« Reply #2 on: August 29, 2016, 07:09:36 pm »
Ehrm, what? It reports the wrong value? What should be the right one? The text looks left aligned to me. And I wouldn't know how to set a different alignment with the GUI. So what does this API method do?

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: DiagramObject.TextAlign
« Reply #3 on: August 30, 2016, 08:54:52 am »
TextAlign options are available from the Appearance section of the context menu for Text elements. (Not Note elements)

However, I can only get it to read as left or right aligned, and I can only set it to left or center aligned.
Code: [Select]
while(i < selectedObjects.Count)
{
var obj as EA.DiagramObject;
obj = selectedObjects.GetAt(i++);

Session.Output("Alignment: " + obj.TextAlign);
obj.TextAlign = obj.TextAlign%3+1;
obj.Update();
}

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: DiagramObject.TextAlign
« Reply #4 on: August 30, 2016, 07:22:11 pm »
I have the same observation: can be set correctly but center is reported wrongly. I guess you will log a bug internally. Could you also ask Roy to add a short sentence that this applies to Text elements?

Did you have a look into the other Show-methods which I posted?

q.