Trapping "Enter" key in _CommandBarComboBoxEvents

  • Thread starter Thread starter Exchnerd
  • Start date Start date
E

Exchnerd

Hi, I have a ATL COM add-in for outlook which has a toolbar and a
button. I added a _CommandBarComboBox to the commandbar and would like
to now trap the "enter" key when user types in something and hits the
"Enter" key. I find that there is only 1 event that is generated -
Change. However, when I trap this event, my handler is never invoked

Any clues???

Thanks
 
Assuming your event handler is correctly set up and instantiated, are you
tabbing out of the combo control? That should fire the Change event.
 
What does "tabbing out" mean? If you are referring to the scope of the
control, it is a member variable and not a stack var. I have
registered for the button OnClick and other events and have registered
in a similar fashion.
 
Tabbing out means to use the Tab key to move from the control. That's what
fires the Change event you're looking for.




What does "tabbing out" mean? If you are referring to the scope of the
control, it is a member variable and not a stack var. I have
registered for the button OnClick and other events and have registered
in a similar fashion.
 
Tabbing out means to use the Tab key to move from the control. That's what
fires the Change event you're looking for.




What does "tabbing out" mean? If you are referring to the scope of the
control, it is a member variable and not a stack var. I have
registered for the button OnClick and other events and have registered
in  a similar fashion.

I've tried this but no event is fired!! Just cannot understand what I
am missing. Does it not fire if you hit the "enter" key?
 
I believe it should but I know for a fact it does when you use Tab.

If it's not firing then the event handler isn't being added correctly.

I rarely use those CommandBarComboBox controls since they are so limited in
usability.




<snip>
I've tried this but no event is fired!! Just cannot understand what I
am missing. Does it not fire if you hit the "enter" key?
 
I believe it should but I know for a fact it does when you use Tab.

If it's not firing then the event handler isn't being added correctly.

I rarely use those CommandBarComboBox controls since they are so limited in
usability.




<snip>
I've tried this but no event is fired!! Just cannot understand what I
am missing. Does it not fire if you hit the "enter" key?

It works now!!

I was releasing the pointer immediately after registering :-((

Now, how do I differentiate between a "Enter" key or lost focus,
change focus? I need to do something similar to google toolbar - when
the user hits the "enter" key, I need to process the request. All
other cases must be ignored
 
What you have with that control is the Change event and that's it. It's very
limited and that's why I almost never use that control.

Normally I'd use a button control and use that click to open a form that has
a drop-down control and possibly others. That lets me get lost focus and
various other events not exposed for a CommandBarComboBox control.




<snip>
It works now!!

I was releasing the pointer immediately after registering :-((

Now, how do I differentiate between a "Enter" key or lost focus,
change focus? I need to do something similar to google toolbar - when
the user hits the "enter" key, I need to process the request. All
other cases must be ignored
 
What you have with that control is the Change event and that's it. It's very
limited and that's why I almost never use that control.

Normally I'd use a button control and use that click to open a form that has
a drop-down control and possibly others. That lets me get lost focus and
various other events not exposed for a CommandBarComboBox control.




<snip>
It works now!!

I was releasing the pointer immediately after registering :-((

Now, how do I differentiate between a "Enter" key or lost focus,
change focus? I need to do something similar to google toolbar - when
the user hits the "enter" key, I need to process the request. All
other cases must be ignored

Are these any different from the controls that IE has? For e.g. Google
toolbar
 
Are these any different from the controls that IE has? For e.g. Google
tool
You could consider the address book itself in outlook. There is a
combo box next to the address book button and it works as expected -
how is this achieved?
 
CommandBar* controls are different than the normal forms combobox controls
or other form controls or controls you see in IE. That's why I use a forms
type combo instead of the CommandBarCombo version, it does what I want.




Are these any different from the controls that IE has? For e.g. Google
tool
You could consider the address book itself in outlook. There is a
combo box next to the address book button and it works as expected -
how is this achieved?
 
CommandBar* controls are different than the normal forms combobox controls
or other form controls or controls you see in IE. That's why I use a forms
type combo instead of the CommandBarCombo version, it does what I want.






You could consider the address book itself in outlook. There is a
combo box next to the address book button and it works as expected -
how is this achieved?

I am talking of the controls on the command bar of outlook, not the
controls on the form that opens up when you click the address book
button. The combo box on the toolbar beside the address book button
that allows us to enter a name to search for. I verified with Spy++
and it is the same class that I am using.!
 
Many of the controls used for CommandBar controls behave differently when
used internally by MS than they do for you and many aren't available to you.
There's nothing you or I can do to change that. What you see is what you get
with that control, and if you aren't happy with how it works for you, use
something else.




<snip>
I am talking of the controls on the command bar of outlook, not the
controls on the form that opens up when you click the address book
button. The combo box on the toolbar beside the address book button
that allows us to enter a name to search for. I verified with Spy++
and it is the same class that I am using.!
 
Back
Top