Book a Demo

Author Topic: How to get color of component via API  (Read 4602 times)

Sarah H.

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
How to get color of component via API
« on: October 24, 2014, 08:55:27 pm »
Hello,
we use color of component to visualise type of component, which is also stored in tagged value.
I wanted to prepare Jscript which would check if the color corresponds to the tagged value. But... I cannot find how to get the background color of element. It seems that reading is not allowed only setting the color.

Any advice for me, please?

Thank you

Sarah

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to get color of component via API
« Reply #1 on: October 24, 2014, 09:15:39 pm »
For individual element check diagramObject.Style where you find
Code: [Select]
BCol=<col>; and a couple of other style parameters. For the global style you will have to look in t_object.backcolor (I don't recall where this is to be found in the API; likely nowhere obvious).

q.

Sarah H.

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: How to get color of component via API
« Reply #2 on: October 24, 2014, 09:50:33 pm »
Thank you, I found it in DB, but I would like to access via API. And documentation says:

Style

Write only (reading this value gives undefined results)

The style information for this object

So it means from my JScript, there is really not "getter" to access color?

Or there is another way how to get the color to the script than attribute or method on element class?

Thank you

Sarah

 

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to get color of component via API
« Reply #3 on: October 24, 2014, 10:00:05 pm »
You can always do a
Code: [Select]
Repository.SQLQuery("Select ...")which returns a XML result set. This is also an "official" way to access non-exposed values from the DB.

q.