[VM] [WinCE][Q] Simulating yellow button with stylus

Noel J. Bergman noel at devtech.com
Sun Feb 17 18:45:46 UTC 2002


Windows CE stylus input emulates only one "mouse button" unless you simulate
middle and right by using some modifier, like holding a particular hardware
button while clicking.  It occurs to me that tap-and-hold would be a
reasonable map for the yellow button.

As I reported last July, I added the following code towards the top of the
WM_?BUTTONDOWN portion of MainWndProc:

#define TAPNHOLD
#if _WIN32_WCE >= 300 && defined(TAPNHOLD)
	{
		SHRGINFO shrgi = {0};

		shrgi.cbSize = sizeof(SHRGINFO);
		shrgi.hwndClient = hwnd;
		shrgi.ptDown.x = LOWORD(lParam);
		shrgi.ptDown.y = HIWORD(lParam);
		shrgi.dwFlags = SHRG_RETURNCMD;

		if(GN_CONTEXTMENU == SHRecognizeGesture(&shrgi))
		{
			MessageBeep(MB_OK);
			wParam = (wParam & ~MK_LBUTTON) | MK_RBUTTON;
			return SendMessage(hwnd, WM_RBUTTONDOWN, wParam, lParam);
		}
	}
#endif

That should turn a WM_LBUTTONDOWN into a WM_RBUTTONDOWN if the stylus is
held down.  I know, from the MessageBeep, that the code is being executed,
but I am not seeing Squeak respond as if it receives a WM_RBUTTONDOWN
message (one of my next tests is to make sure that message is being
received).  I think I also tried doing a PostMessage, instead, without any
useful change in behavior.

Can anyone spot something that I might have done wrong?  I haven't had a
chance to play with this since reporting it last summer, and never received
any feedback.

	--- Noel




More information about the Squeak-dev mailing list