Book a Demo

Author Topic: Set Context element in a diagram  (Read 4577 times)

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Set Context element in a diagram
« on: May 29, 2014, 12:02:55 am »
Hi,

is it possible and how to set the context element in a diagram.

I can select Diagramobjects but not say this i the context object.

Thanks,

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Set Context element in a diagram
« Reply #1 on: May 29, 2014, 02:54:15 am »
I don't understand your question.

q.

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: Set Context element in a diagram
« Reply #2 on: May 29, 2014, 03:08:06 am »
A context element in a diagram I can get with repository.getContextObject(); My usual way to get the last selected element.

It works well.

If a reload a diagram the context element is lost. I would like to set it again so that I can work with is by an Addin.

I think your question guided me to the solution.

I select one diagram element after reload the diagram. That's all and simple. If I get no context element I just take the one selected. I haven't seen the simple solution.

Thanks a lot for your question.

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Set Context element in a diagram
« Reply #3 on: May 29, 2014, 03:37:58 am »
np  :)

q.

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: Set Context element in a diagram
« Reply #4 on: May 29, 2014, 04:02:36 am »
I've tried it it works.

Although a diagramobject is selected sometimes I get with rep.GetContextItemType() an otNone. That has the effect I have to click on the selected diagram element once more to make the Addin work as expected. That's bothers.

The problem occurs:
- My Addin reload the diagram
- My Addin selects the wanted element
- rep.GetContextItemType() returns a otNone.

Thanks,

Helmut





Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)