Book a Demo

Author Topic: Event for Selected Element changed in Project Browser  (Read 4104 times)

TheMintRubber

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Event for Selected Element changed in Project Browser
« on: August 22, 2017, 11:05:11 pm »
Hi,

I am using WPF to write an Enterprise Architect addin.

I need to react when a user selects an item in the project browser. Is there an event for this?

I've already found the broadcast event page, but I couldn't find anything in there. http://www.sparxsystems.com/enterprise_architect_user_guide/10/automation_and_scripting/broadcastevents.html.

I also know there is the EARepository.GetTreeSelectedItem() method, that returns the item selected in the project browser, but I would have to add a timer and call this method every 500 ms or so, so this is not a good idea.

Any ideas?

Thanks,
Doru.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Event for Selected Element changed in Project Browser
« Reply #1 on: August 22, 2017, 11:37:53 pm »
Try EA_OnContextItemChanged.

q.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Event for Selected Element changed in Project Browser
« Reply #2 on: August 22, 2017, 11:39:44 pm »
Hi Doru,


You want the "context item" events, specifically EA_OnContextItemChanged(). This alerts the Add-In that the user has changed their selection in the GUI.

The similarly named EA_OnNotifyContextItemModified() is fired when the element, attribute, etc data has been modified.

HTH,


/Uffe
My theories are always correct, just apply them to the right reality.