Scripting Resources for DigitalMicrograph™

banner

Dave Mitchell's DigitalMicrograph™ Scripting Website

Home | Scripts | Examples | Functions | Recent Updates | Tutorials | Resources | Publications | Consulting | Projects | Contact & Bio |PyJEM| Search

 

Example: Capture Mouse Click Position
Function
An example script based on Gatan's demonstration code which shows how to capture the position of mouse clicks.
Version
20180825, v1.0
Author
D. R. G. Mitchell
Acknowledgements
Based on Gatan's demonstration code in the online help.
Comments

Being able to click on features to mark or identify them is mighty handy. In GMS 2 it was possible to find the position of the cursor, but not to respond to a mouse click (without a third party plugin). This functionality has now been built into GMS 3. The only problem is that scripts using the functionality will not be backwardly compatible with GMS 2 and earlier.

This script adds an event listener to the front-most image which listens for mouse clicks and marks their position. It also adds a key listener, which listens for any key being pressed - which terminates both the mouse and key listening.

System Requirements
Only compatible with GMS 3.
Known Issues
Supported
Yes
Included Files
Main script file.
Source Code

see attached source code.