Accelerators in modeless _property sheet_
Jeff Wishnie -- jwishnie@swellsoft.com
Friday, September 06, 1996
Environment: VC++ 4.2, WIN95
I have several modeless Property Sheet's in my application and I'd like
accelerator keys to function even when the sheets are active.
I've looked at KB article: Q117500
"Using Accelerators with an MFC Modeless Dialog Box"
Which explains that to get accelerators to work in a modeless dialog, just
override PreTranslateMessage to pass the key event to the mainframes
accel-table.
I tried a similar approach with the modeless property sheet overriding
pretranslate message on all the following:
the CMiniFrameWnd that holds the sheet
the CPropertySheet subclass
each CPropertyPage subclass
But none of these methods are called.
Spy++ verifies that the WM_KEYDOWN and WM_KEYUP messages that should issue
the accelerator are caught by the current focused control in the sheet, not
by the Frame, Sheet, or Pages.
Is there any way to get these messages before they are distributed to the
focused control? I'd hate to have to write special button, list, slider,
etc... subclasses just to trap this message!
Thanks for any help.
- Jeff
jwishnie@swellsoft.com
Steve Mark -- steve@otms.com
Sunday, September 08, 1996
Jeff,
FWIW: I have the same problem in 1.52. Here's what I put in my property
sheet class to get the mainframe menu accelerators to work (note:
accelerators on controls in the property sheet still do not work):
BOOL CMySheet::PreTranslateMessage(MSG* pMsg)
{
HACCEL hAccel = ((CMainFrame*)AfxGetMainWnd())->GetAccelTable();
if(hAccel && ::TranslateAccelerator(AfxGetMainWnd()->m_hWnd,
hAccel, pMsg))
return TRUE;
else
return AfxGetMainWnd()->PreTranslateMessage(pMsg);
}
Steve
At 02:48 PM 9/6/96 -0700, you wrote:
>Environment: VC++ 4.2, WIN95
>
>I have several modeless Property Sheet's in my application and I'd like
>accelerator keys to function even when the sheets are active.
>
>I've looked at KB article: Q117500
>"Using Accelerators with an MFC Modeless Dialog Box"
>
>Which explains that to get accelerators to work in a modeless dialog, just
>override PreTranslateMessage to pass the key event to the mainframes
>accel-table.
>
>I tried a similar approach with the modeless property sheet overriding
>pretranslate message on all the following:
>
>the CMiniFrameWnd that holds the sheet
>the CPropertySheet subclass
>each CPropertyPage subclass
>
>But none of these methods are called.
>
>Spy++ verifies that the WM_KEYDOWN and WM_KEYUP messages that should issue
>the accelerator are caught by the current focused control in the sheet, not
>by the Frame, Sheet, or Pages.
>
>Is there any way to get these messages before they are distributed to the
>focused control? I'd hate to have to write special button, list, slider,
>etc... subclasses just to trap this message!
>
>Thanks for any help.
>
>- Jeff
>jwishnie@swellsoft.com
>
>
>
>
| Вернуться в корень Архива
|