Topic: Mouse support for Get_Key() (1 of 1), Read 9 times
Conf: VEDIT Macro Language Support
From: Pauli Lindgren
Date: Friday, October 23, 2009 05:21 AM

Ted, now that you are working with keyboard input, maybe you could check if it would be possible to add mouse support to Get_Key function?

That would make it possible to have mouse input option in macros such as cfunc.vdm, bfunc.vdm, srchshow.vdm, and my markers.vdm and t_reg.vdm.

Whenever I show Vedit to people, one of the first things they notice is that Vedit is "old fashioned" because it does not support mouse in these functions.

I think it should not be too difficult to implement.
First, Vedit should handle Windows messages while in Get_Key loop, perhaps by calling DoEvents() now and then.
(Or maybe even that is not necessary, since mouse events are probably already received in the same message loop that receives keyboard messages?)
Then, if mouse click message is received, it could be converted to some special key code and returned as return value from Get_Key().

The macro could then check if it is a mouse click, and read coordinates from some internal values (e.g. MOUSEX and MOUSEY).
Or alternatively, a single click could move cursor in the window the same way as when editing text.
Double-click would then return a different key code and the macro could handle that just like a keypress.

Handling Windows events while in the input loop would also make it possible to move the macro window with mouse while waiting for input.

--
Pauli