Author Topic: Reset diagram object back to default backgroundColor  (Read 520 times)

Ian Mitchell

  • EA User
  • **
  • Posts: 440
  • Karma: +19/-4
  • The eaDocX and Model Expert guy
    • View Profile
Reset diagram object back to default backgroundColor
« on: May 07, 2022, 12:24:03 am »
When I read the 'backgroundColor' of a diagramObject, it comes back as '-1', which means 'default color' for this element type, as defined by it's MDG. Which is my case is Archimate, and as the element is a ApplicationComponent, it's pale blue in my diagram. All good, exactly as in the documentation.

Now I change the color to a different one, but I'm not totally stupid, and I remember what the original color was : '-1'.

Later, I want to change the back to what is was originally: so I set the backgroundColor to -1, and....it goes white. Not the 'default color'.
The database confirms this: BCol=13882323, which is white. Same is true for the border and font colors - all set to white.

But I have a plan - set these colors to 'nothing' via the API. Doesn't work - that just makes them black.

But I get out my big stick, and edit those the entries in t_DiagramObject.ObjectStyle, and delete BCol=.. then all is well. Back to having the default color.

Anyone else seen this feature? Or did I miss something ?

Another hour of my life I'd like to claim back from Sparx.
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11819
  • Karma: +458/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Reset diagram object back to default backgroundColor
« Reply #1 on: May 07, 2022, 12:31:22 am »
According to the documentation, setting it back to -1 should work: https://sparxsystems.com/enterprise_architect_user_guide/16.0/add-ins___scripting/diagramobjects.html

Quote
BackgroundColor

Long

Notes: The background color of the object on the diagram.

Set to -1 to re-set to the default color in the model.

So if that doesn't work it's officially a bug.

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8158
  • Karma: +231/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Reset diagram object back to default backgroundColor
« Reply #2 on: May 07, 2022, 09:48:50 am »
According to the documentation, setting it back to -1 should work: https://sparxsystems.com/enterprise_architect_user_guide/16.0/add-ins___scripting/diagramobjects.html

Quote
BackgroundColor

Long

Notes: The background color of the object on the diagram.

Set to -1 to re-set to the default color in the model.

So if that doesn't work it's officially a bug.

Geert
+1


Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Ian Mitchell

  • EA User
  • **
  • Posts: 440
  • Karma: +19/-4
  • The eaDocX and Model Expert guy
    • View Profile
Re: Reset diagram object back to default backgroundColor
« Reply #3 on: May 09, 2022, 05:21:24 pm »
Further strangeness - now between v15.1 and v16 (32bit).
Something major has changed with the refreshing of diagrams. My addin removes and adds-back diagram obejcts in a diagram, an relies on the Repository.reloadDiagram call to get a new-look diagram.
Except that with V16, nothing happens. I will post later when I have time to isolate the problem ,but a simple switch back to V15 fixed the issue.
Any one else seen issues with reloading diagrams ?
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

Ian Mitchell

  • EA User
  • **
  • Posts: 440
  • Karma: +19/-4
  • The eaDocX and Model Expert guy
    • View Profile
Re: Reset diagram object back to default backgroundColor
« Reply #4 on: May 09, 2022, 06:28:18 pm »
I'm also getting a lot of 'Your need to reaload diagram' messages coming up in the UI, when changing the diagram. These don't happen in V15.2, but pop up quite frequently in V16. Distracting for the user.
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

steverumsby

  • EA Novice
  • *
  • Posts: 4
  • Karma: +1/-0
    • View Profile
Re: Reset diagram object back to default backgroundColor
« Reply #5 on: June 02, 2022, 01:08:18 am »
Yes, I'm getting the same thing. I have a script to add a heatmap to an archimate diagram and I'd like another to restore the default colouring, but that just turns everything white as you say. But setting the background colour to "default" via the layout ribbon does what it is supposed to. That at least saves a certain amount of pain...

Did you find a solution to this, or is it a bug we need to report?

Thanks,
Steve.