// Script function: Listener to output X-coordinate and Y-coordinate in Output window.
// Requirement: Open an image and create a point ROI on it.

// Unless named starting with GlobalSino, EM, My, Self, the function commands are defined 
//by Gatan DM, please see at link: http://www.globalsino.com/EM/page2597.html



Class GlobalSinoPointListener: object
{
   void GlobalSinoEM( object EM, ROI GlobalSinoEMROI ){ 

ROI GlobalSinoROI = GetFrontImage().ImageGetImageDisplay(0).ImageDisplayGetROI(0)
   number MyROIx, MyROIy
   GlobalSinoROI.ROIGetPoint(MyROIx, MyROIy)
Result( "X-coordinate: " + "\t" + MyROIx + "\t" + "Y-coordinate: " + "\t" + MyROIy + "\n"); 

}
}
{
    Image GlobalSinoSI := GetFrontImage()
    ROI GlobalSinoPoint = NewROI()
    GlobalSinoPoint.ROISetPoint(30, 40)
           
    
    GlobalSinoSI.ImageGetImageDisplay(0).ImageDisplayAddROI(GlobalSinoPoint)
    
    Number EMROI = GlobalSinoPoint.ROIGetID()
    
    ROI GlobalSinoROI = GetFrontImage().ImageGetImageDisplay(0).ImageDisplayGetROI(0)
            number MyROIx, MyROIy
        GlobalSinoROI.ROIGetPoint(MyROIx, MyROIy)
    
    object EMListener = Alloc(GlobalSinoPointListener)          
    ConnectObject( EMROI, "changed", "ConnectionID", EMListener, "GlobalSinoEM" )         
}















