OnChar() w/ CComboBox controls 
Author Message
 OnChar() w/ CComboBox controls

I want to filter keyboard input in a CComboBox derived class.  It does not
appear that the OnChar(), OnKeyDown(), or OnKeyUp() methods get called when
the user types into these controls.

Does anyone know how I would trap and filter keystrokes in a CComboBox
derived class?

Thanks.



Mon, 20 Jun 2005 22:01:09 GMT  
 OnChar() w/ CComboBox controls

Quote:
> I want to filter keyboard input in a CComboBox derived class.  It does not
> appear that the OnChar(), OnKeyDown(), or OnKeyUp() methods get called
when
> the user types into these controls.

> Does anyone know how I would trap and filter keystrokes in a CComboBox
> derived class?

It's a pretty safe bet that these messasges are going to the combo's edit
control.

--
Jeff Partch [VC++ MVP]



Mon, 20 Jun 2005 22:41:37 GMT  
 OnChar() w/ CComboBox controls

Quote:



>> I want to filter keyboard input in a CComboBox derived class.  It does not
>> appear that the OnChar(), OnKeyDown(), or OnKeyUp() methods get called
>when
>> the user types into these controls.

>> Does anyone know how I would trap and filter keystrokes in a CComboBox
>> derived class?

>It's a pretty safe bet that these messasges are going to the combo's edit
>control.

And since the combobox is parent to its editbox (unlike its dropdown
listbox), he might be able to derive a class from CComboBox and override
PreTranslateMessage, which would be significantly easier than subclassing
the embedded editbox.

--
Doug Harrison
Microsoft MVP - Visual C++



Mon, 20 Jun 2005 23:14:57 GMT  
 OnChar() w/ CComboBox controls
This is another of the places where PreTranslateMessage makes sense. I'm not a fan of this
method because it is grossly abused for the wrong reasons, but this is the sort of place
it is one of the better approaches.
                                        joe


Quote:



>>> I want to filter keyboard input in a CComboBox derived class.  It does not
>>> appear that the OnChar(), OnKeyDown(), or OnKeyUp() methods get called
>>when
>>> the user types into these controls.

>>> Does anyone know how I would trap and filter keystrokes in a CComboBox
>>> derived class?

>>It's a pretty safe bet that these messasges are going to the combo's edit
>>control.

>And since the combobox is parent to its editbox (unlike its dropdown
>listbox), he might be able to derive a class from CComboBox and override
>PreTranslateMessage, which would be significantly easier than subclassing
>the embedded editbox.

Joseph M. Newcomer [MVP]

Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm


Tue, 21 Jun 2005 04:07:22 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. OnChar message of a CEdit control

2. Problem with subclassed Edit Control and OnKeyDown + OnChar

3. limit of CComboBox and handling of scrolling event in a CComboBox

4. CComboBox control variable

5. CComboBox 'Sort'ing Under Program Control?

6. CComboBox control

7. CComboBox control question

8. CEdit style in a CComboBox control

9. Setting the size of the drop down for a CComboBox control

10. Program Freezes when using CComboBox Control with Property Page

11. Subclassing edit-control of CComboBox

12. Can multiple CComboBox controls share data?

 

 
Powered by phpBB® Forum Software