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

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


Esc in combobox on toolbar

Jim Beveridge -- jimb@turningpoint.com
Friday, January 12, 1996

I have a CToolBar in which I manually created a combobox.  The 
problem is that the standard keys such as Escape and Return do 
not cancel or accept the current selection in the combobox and 
return focus to the current view.  (It works in Microsoft Word 
:-)

This bug also exists in the CTRLBARS example in both VC 2.2 and 
4.0.

The brute force solution seems to be to put code in the 
mainframe to deal with the accelerators in a special fashion 
when the combobox has the focus, but if anyone has a better 
solution, I'd love to hear it.

Thanks,
Jim Beveridge



Chong Zhang -- cz@dana.ucc.nau.edu
Tuesday, January 16, 1996

On Fri, 12 Jan 1996, Jim Beveridge wrote:

> I have a CToolBar in which I manually created a combobox.  The 
> problem is that the standard keys such as Escape and Return do 
> not cancel or accept the current selection in the combobox and 
> return focus to the current view.  (It works in Microsoft Word 
> :-)
> 
> This bug also exists in the CTRLBARS example in both VC 2.2 and 
> 4.0.
> 
> The brute force solution seems to be to put code in the 
> mainframe to deal with the accelerators in a special fashion 
> when the combobox has the focus, but if anyone has a better 
> solution, I'd love to hear it.
> 
> Thanks,
> Jim Beveridge
> 

I subclassed the combo box of cause and I subclassed the edit box inside 
of the combo box. I returned DLGC_WANTALLKEYS when processing the 
WM_GETDLGCODE message in the edit box so that the edit box will recieve 
all the key strokes before they are translated according to the 
accelerator table. Then every thing worked just like WORD and EXCEL.




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