I just started playing around with Genexus SDK to make some extensions for the platform.
I was testing the Event Subscription System that is avaliable: The classes that exposes those Events that I found were:
UIEvents
GXEvents
and UIDocumentsEvents
.
In my case specifically, I need to trigger an event when the developer focuses/selects an already open object in the KB, just like Genexus does when you have the "properties" ToolWindow open, if you change the object which you're using to another, it automatically updates that ToolWindow with the current object information.
I've noticed that the class UIEvents
has an event AfterOpenKBObject
, but it excutes only once (after the object is opened).
Is it possible to implement an event behavior similar to the "properties" ToolWindow that i described?
The way that the Properties window achieves this is by subscribing as a SelectionChanged listener in the TrackSelection service.
Guid myTrackingId = Guid.NewGuid();
UIServices.TrackSelection.Subscribe(myTrackingId, new MySelectionChangedTracker());
Then when you wish to stop receiving selection changed events, remember to call unsubscribre.
UIServices.TrackSelection.Unsubscribe(myTrackingId);