Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: etaha on January 30, 2018, 09:05:54 am
-
Is there a way/event to change status of an element after user change any attribute of an element?
For example, if element status is approved I need to revert it back proposed in case user change element name/description/tagvalue etc..
Thanks in Advance.
-
You need to write an add-in for that (or use Geert Bellekens' EA-Matic). There's a broadcast event which tells you that an element has changes and you can do further action.
q.
-
Thanks a lot.
I've checked all broadcast events documentation amd EA-Matics available events; but I couldn't figure out which event to use.
There are events for pre-posting/deleting element but none for modify element.
-
Hello,
You're looking for EA_OnNotifyContextItemModified. It's in with the other context item events.
Note, however, that semantically this approach will only ever give you a partial solution. It doesn't cover all cases where something is changed which affects en element (eg inherited attributes).
/Uffe
-
I'll check that event; It's wierd that it's under contextmenu.
Thanks you all.
-
Hehe. EA is not only unique in its user interface but also in its documentation. The people from planet Sparx have a different mindset than us common earthlings.
q.
-
I'll check that event; It's wierd that it's under contextmenu.
It's not context menu -- it's context item.
The context item events tell you when the user has changed the selection in the GUI, double-clicked something or made changes to the currently selected thing (element, diagram, etc).
So they're GUI-related, but nothing to do with any menus.
/U
-
Thanks for the note..and sorry I didn't notice it..
I've register that event with EA-Matic and it works, but there is an issue when user wants to change to Approve this will automatically revert to Proposed
function EA_OnNotifyContextItemModified(GUID, ot)
Dim el
If ot = EA.ObjectType.otRequirement then
Set el = Repository.GetElementByGuid(GUID)
if el.Status = "Approved" then
el.Status = "Proposed"
el.Update()
end if
end if
end function
Is there a way to know the updated attributes of the element?
Thanks a lot.
-
By default there is no method says which are the attributes got updated. You have to do a compare, then update . EA_OnNotifyContextItemModified will be triggered when current context item has been modified
-
Thanks for the reply..
As per my tests, this event is not triggered unless user clicks on Apply or Ok buttons, which is after the changes happened and no way to get element attributes' values before updated by this event only.
Any ideas?
Thanks in Advance...
-
You have to get the previous values in session for a compare. When the user clicks next element/connector/diagram EA_OnContextItemChanged event will get triggered.
-
Many thanks.. I'll try it out.
-
Appreciated. Many thanks to all. It works.