Need to register keyboard and mouse events

Need to register keyboard and mouse events

I need to detect keystrokes as well as mouse events in my vector graphics windows so I can respond to either. I don't see how to do it in QuickWin and not have one block the other. I also need to know the mouse cursor coordinates at the time of a keystroke, though I suppose I can query for the mouse cursor position quickly after the keystroke event.

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

use dflin & dfwin.
Setup event handler function eg ISUB:
iw = GETHWNDQQ(0)
ichild = SETWINDOWLONG(iw, GWL_WNDPROC, loc(ISUB))

function ISUB(iw, msg, iparam, lparam)
.....
These values of msg may be useful
WM_CHAR: character = char(iparam)
WM_MOUSEMOVE: mousex = lparam.and.65535; mousey = rshift(lparam, 16)
WM_LBUTTONDOWN etc

To pass on event to normal handler:
ISUB = CALLWINDOWPROC(ichild, iw, msg, iparam, lparam)
Otherwise:
ISUB = 0

Grrrr, I replied to this a week ago though I didn't see it never appeared. Here it is again:

What you need is probably subclassing and/or hooking. Similar questions appeared here earlier; I'll try to summarize links here:

- Subclassing is the technique for catching all events for a particuar window;

- Hooking is technique for catching all events of certain class (e.g. keyboard) for entire application (or several windows simultaneously);

- See recent response about getting/setting mouse position/mouse button states/keyboard button states;

Please repost if you need answers to more specific questions.

Jugoslav

Jugoslav
www.xeffort.com

Thank you alfredodell and Jugoslav Dujic for your responses. I took the subclassing code from the QuickWin sample "poker.f90" program and am going to try to modify it to make it work in the QuickWin sample "qwpaint.f90" program to capture a keystroke when mouse is in "canvas" window.
What is the significance of the argument "0" in the call to GetHWndqq. I don't see any documentation on the effects of "0"?

Thanks, again

IIRC 0 is unit for default child window. If you never open any window using OPEN(iUnit, FILE="User"), 0 is the unit of the default one (initially hidden).

Jugoslav
www.xeffort.com

Leave a Comment

Please sign in to add a comment. Not a member? Join today