; NAME: ; CURSOR_NG ; ; PURPOSE: ; This procedure returns X, Y coordinate of a point of mouse click on a NG window ; ; AUTHOR: ; Sangwoo Lee, Ph.D. ; SELab, Inc. ; Seoul, Korea ; Phone: 82-10-3727-1172 ; E-mail: lee@spweather.com ; ; USAGE: ; CURSOR_NG, win, xc, yc ; ; RETURN VALUE: ; xc, yc as pointers ; ; ARGUMENTS: ; win: reference to a NG window ; xc, yc: two pointers for X, Y coordinate ; after retrieveing them, they should be dereferenced like *xc, *yc ; in order to get the coordinate values ; coordinate values are in device or data coordinate system ; (mouse left button : device, mouse right button : data) ; ; Keywords: ; None ; ; MODIFICATION HISTORY: ; First written on Mar 22, 2019. ; ;****************************************************************************************** ; Copyright (c) 2019, by Sangwoo Lee and SELab, Inc. ; ; All rights reserved. ;****************************************************************************************** FUNCTION CURSOR_NG_mouse_down, win, X, Y, Button, KeyMods, Clicks IF Button EQ 1 THEN BEGIN; device coord *((win.UVALUE)[0]) = x *((win.UVALUE)[1]) = y PRINT, x, y ENDIF IF Button EQ 4 THEN BEGIN; data coord result = win.ConvertCoord(x, y, /DEVICE, /TO_DATA) x = result[0] y = result[1] *((win.UVALUE)[0]) = x *((win.UVALUE)[1]) = y PRINT, x, y ENDIF RETURN, 0 END PRO CURSOR_NG, win, xc, yc IF win EQ !null THEN BEGIN img = HANNING(600, 600)*100 sz = SIZE(img, /DIM) win = WINDOW(DIMENSIONS=sz, MARGIN=0) im = IMAGE(img, MARGIN=0, /CURRENT) ENDIF xc = PTR_NEW(/ALLOCATE_HEAP) yc = PTR_NEW(/ALLOCATE_HEAP) info_list = LIST(xc, yc) win.UVALUE = info_list win.MOUSE_DOWN_HANDLER = 'CURSOR_NG_mouse_down' END