The DigitalMicrograph scripting documentation alludes to various types of Listener objects that can be used to notify a script object of various types of events. In particular, ImageDisplay objects have explicit support for key listeners so that a script object can be notified when a keystroke event is targeted to a specific image display. Is it possible to receive notification that an ROI on an image has been changed in size or position via a similar mechanism?
相关问题
- Stop child process when parent process stops
- Fire resize event once not based on timing
- C# CS0079 Event Handling Compile Errors
- Google Maps event listeners not working properly i
- execute method when iPhone enters landscape mode
相关文章
- What does it means in C# : using -= operator by ev
- How are custom broadcast events implemented in Jav
- Programming a touch screen application with SWING
- How many pixels are scrolled on a website with a m
- Difference Between RoutedEventHandler and EventHan
- Wait for function till user stops typing
- WPF- validation error event doesn't fire
- Button onclick doesn't fire after onchange inp
Yes there are. In fact, as far as ROIs are concerned there are two possibilities.
First option: Listen to a specific ROI
Any ROI in DigitalMicrograph has a unique ID number. You can add a listener to that particular ROI-ID as with the script below. Note, that the identical ROI can be placed on more than one ImageDisplay at the same time. ("linked ROIs"). The connected listener object will not be released as long as the ROI object is not released, but you can also explicitly remove the connection.
This method only accepts "changed" as a message, and the 3rd parameter string (ConnectionID) should be unique, so that it can be used to remove this particular connection as shown. The main advantage of this method is its simplicity.
Second option: Listen to a specific imageDisplay
There are also listeners which you can connect to an imageDisplay object. This allows catching messages from 'any' ROI on this imageDisplay, but you can again use the unique-ROI-ID to filter out those you are interested in. The listener object will not be released as long as the imageDisplay is not released, but again you can unregister it manually.
Unless you have to monitor a specific ROI over multiple imageDisplays, the second option is the more versatile one. The method you register the roi_changed event with not only gives you a handle on the ROI, but also on the display it sits on. The number variables contain the event-flags telling you what has changed.
In GMS 2.3.1 there are currently the following ROI messages available:
and they need to be connected to methods of signature
Examples
You can find listerner-type script examples on the FELIM script database, i.e.: