15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Button Accelerator Keys In Dialog Bars

Jeff -- JEFFF@twgi.com
Thursday, October 24, 1996


Environment: Visual C++ 4.1, Win32s 1.30, Windows 95, Windows NT 4.0   
(released version -- no one should be still using the betas)

Our MDI app makes use of MDI child frames that contain docked dialog   
bars. Those buttons have accelerator keys defined, as in "&Close", which   
defines an automatic accelerator key of "Alt+C", as is the case with all   
standard Windows dialogs. In some cases, there may be conflicts with the   
main frame's menu accelerators, and, as such, MFC (or the operating   
system) is routing the accelerator key to the main frame's menu bar and   
not to the dialog bar.

I realize that the conflicts should be resolved, but I am still puzzled   
as to why the dialog bar is not getting the first crack at the   
accelerator key. It seems as though the dialog bar is never getting these   
system accelerator keys, even in the cases where there is no accelerator   
key conflict between it and the main frame menu bar.

I want to point out that, by using the term "accelerator key", I am not   
referring to an entry in our application's accelerator table. I am   
referring to the operating system-supported convention of allowing to   
"hotkey" to a control by holding down the Alt key and pressing the key   
corresponding to the underlined letter of the control's label.

Does anyone have any suggestions for allowing dialog bars to get a crack   
at Alt-related system-supported accelerator keys?

Regards,
 -- Jeff Ferguson (JeffF@twgi.com)
 -- The Weidt Group, Inc. [http://www.twgi.com]



Dong Chen -- d_chen@ix.netcom.com
Sunday, October 27, 1996

>
>Does anyone have any suggestions for allowing dialog bars to get a crack   
>at Alt-related system-supported accelerator keys?
>
>Regards,
> -- Jeff Ferguson (JeffF@twgi.com)
> -- The Weidt Group, Inc. [http://www.twgi.com]
>

Check out MSJ 7/1995 C++ Q/A column. Basically, I think you need to
overwrite the PretranslateMessage to get your bar specific accelerator and
then the WindowProc if you want to reroute the command messages.

--
Dong





| Вернуться в корень Архива |