View Full Version : Tab Stops and Mnemonics??
Ron
October 13th, 2002, 03:55 PM
Weird my C plugins works just fine. (well I tested the Alarmtimer plugin and it works there )
SteveV
October 13th, 2002, 03:55 PM
I'm not sure if this is particular to Girder versions 3.1/3.2 but I have been unable to get tab stopping or mnemonics working in any of my plugins.
I have set the tabstop property on the controls in question but Girder appears to ignore Tab and Shift/Tab keys.
I've searched the forum and all I could find was this post (http://www.girder.nl/phpBB2/viewtopic.php?t=2128&highlight=tab+stops)
--Steve
SteveV
October 13th, 2002, 03:55 PM
Here's a little more info:
All of the Windows API plugins I checked (Send Message, Say, RegSetValue) work properly with tab stops.
All of the MFC based plugins I checked (SLinkE, OSD PopUp, TimeToString, User Events) don't work properly with tab stops. Although, through some weird twist of fate and logic, on the SLinkE plugin, the plugin settings dialog works as expected but the action dialog does not :o
What's more, the cancel key doesn't dismiss the MFC based dialogs.
Chaulk up another oddity to the MFC.
--Steve
SteveV
October 13th, 2002, 03:55 PM
After a bit more research, here's the ugly fix: Microsoft KB Article "PRB: ActiveX Control Is the Parent Window of Modeless Dialog (Q187988)" (http://support.microsoft.com/default.aspx?scid=kb;en-us;Q187988). Would've been nice if the title of the article actually resembled the problem at hand...
In short(??) you'll need to do the following:
In your App's .cpp file, include the following global variable and global function:
// Handle to the Windows Message hook.
HHOOK hHook = NULL;
// Hook procedure for WH_GETMESSAGE hook type.
LRESULT CALLBACK GetMessageProc(int nCode, WPARAM wParam, LPARAM lParam)
{
// Switch the module state for the correct handle to be used.
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
// If this is a keystrokes message, translate it in controls'
// PreTranslateMessage().
LPMSG lpMsg = (LPMSG) lParam;
if( (nCode >= 0) && PM_REMOVE == wParam
&&(lpMsg->message >= WM_KEYFIRST
&& lpMsg->message <= WM_KEYLAST)
&& AfxGetApp()->PreTranslateMessage((LPMSG)lParam)
)
{
// The value returned from this hookproc is ignored, and it cannot
// be used to tell Windows the message has been handled. To avoid
// further processing, convert the message to WM_NULL before
// returning.
lpMsg->message = WM_NULL;
lpMsg->lParam = 0L;
lpMsg->wParam = 0;
}
// Passes the hook information to the next hook procedure in
// the current hook chain.
return ::CallNextHookEx(hHook, nCode, wParam, lParam);
}
Add the following to the bottom of your App's header file:
extern LRESULT CALLBACK GetMessageProc(int nCode, WPARAM wParam, LPARAM lParam);
extern HHOOK hHook;
In your dialog class' cpp you'll need to include message handlers for OnInitDialog and OnClose.
Add to following code to OnInitDialog:
// Install the WH_GETMESSAGE hook function.
hHook = ::SetWindowsHookEx( WH_GETMESSAGE, GetMessageProc,
AfxGetInstanceHandle(), GetCurrentThreadId() );
ASSERT (hHook);
Add the following code to OnClose:
// Uninstall the WH_GETMESSAGE hook function.
VERIFY (::UnhookWindowsHookEx (hHook));
--Steve
Mark F
October 13th, 2002, 03:55 PM
Thanks, Steve! If I ever find some time at home, I'll update my plugins.
Snakebite
October 13th, 2002, 03:55 PM
Wonderful!
Snakebite
October 13th, 2002, 03:55 PM
RonB,
while implementing this I noticed something you should fix in Girder. :) The treepicker_show function should activate the treepicker dialog. Now I can tab around my fields, hit return on a command browse-button, but then the treepicker isn't active and I have to reach for the mouse to click it. Whenever you have time, of course. :)
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.