Here's a simple program that tracks a cursor in a %gr drawing surface:
WINAPP
OPTIONS (INTL, DREAL)
PROGRAM FOLLOW_THE_MOUSE
C ------------------------
COMMON /MOUSE/ IX, IY, LW, JX, JY
INCLUDE <WINDOWS.INS>
EXTERNAL KB_GET_CURSOR_POS
DIMENSION IAR(3)
IAR = 25 ! whole array
JX = 0
JY = 0
IW = WINIO@ ('%ca[Follow the cursor]&')
IW = WINIO@ ('%3sb%lc&', IAR, LW)
IW = WINIO@ ('%`cu&', CURSOR_ARROW)
IW = WINIO@ ('%^gr[blue,full_mouse_input]', 600, 400,
& KB_GET_CURSOR_POS)
END
INTEGER FUNCTION KB_GET_CURSOR_POS()
C ------------------------------------
COMMON /MOUSE/ IX, IY, LW, JX, JY
CHARACTER*(20) XTEXT, YTEXT
INCLUDE <WINDOWS.INS>
IX = CLEARWIN_INFO@ ('GRAPHICS_MOUSE_X')
IY = CLEARWIN_INFO@ ('GRAPHICS_MOUSE_Y')
WRITE(XTEXT,'(' X=',I4)') IX
WRITE(YTEXT,'(' Y=',I4)') IY
CALL DRAW_LINE_BETWEEN@ (JX, JY, IX, IY, RGB@(255,255,255))
JX = IX
JY = IY
CALL SET_STATUS_TEXT@ (LW, 0, XTEXT)
CALL SET_STATUS_TEXT@ (LW, 1, YTEXT)
KB_GET_CURSOR_POS = 2
END
Interestingly, the line becomes broken if I use USE_GDIPLUS@, so clearly it needs to be more than 1 pixel wide for the smoothing not to break up the line.
My question is: How do I detect the drawing surface losing focus? I could then blank the coordinates in the status bar (and also at the expense of a little programming, deal with re-entry properly, but after all, this is just a demonstrator).
Working with %sb, and comparing my efforts to MS apps, it does seem to me that it would be handy to have a slider %sl control in the status bar, wouldn't it? (for Zooming, principally).
Eddie