Trapping "Enter" key in _CommandBarComboBoxEvents

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
 
K

Ken Slovak - [MVP - Outlook]

Assuming your event handler is correctly set up and instantiated, are you
tabbing out of the combo control? That should fire the Change event.
 
E

Exchnerd

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.

Assuming your event handler is correctly set up and instantiated, are you
tabbing out of the combo control? That should fire the Change event.

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm


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???
 
K

Ken Slovak - [MVP - Outlook]

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.
 
E

Exchnerd

Tabbing out means to use the Tab key to move from the control. That's what
fires the Change event you're looking for.

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm


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?
 
K

Ken Slovak - [MVP - Outlook]

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?
 
E

Exchnerd

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.

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm


<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
 
K

Ken Slovak - [MVP - Outlook]

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
 
E

Exchnerd

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.

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm


<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
 
E

Exchnerd

What you have with that control is the Change event and that's it. It'svery
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.
--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm
"Exchnerd" <[email protected]> wrote in message
<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
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?
 
K

Ken Slovak - [MVP - Outlook]

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?
 
E

Exchnerd

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.

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm



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.!
 
K

Ken Slovak - [MVP - Outlook]

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.!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top