Group:  Microsoft Outlook » microsoft.public.outlook.program_addins
Thread: Trapping "Enter" key in _CommandBarComboBoxEvents

Geek News

Trapping "Enter" key in _CommandBarComboBoxEvents
Exchnerd <sanjuraja[ at ]gmail.com> 11/11/2008 10:46:55 PM
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
Re: Trapping "Enter" key in _CommandBarComboBoxEvents
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 11/12/2008 2:38:05 PM
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


"Exchnerd" <sanjuraja[ at ]gmail.com> wrote in message
news:4a6092e7-ae6c-446e-89fa-c0350c0f6416[ at ]w1g2000prk.googlegroups.com...
[Quoted Text]
> 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

Re: Trapping "Enter" key in _CommandBarComboBoxEvents
Exchnerd <sanjuraja[ at ]gmail.com> 11/12/2008 3:44:29 PM
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.

On Nov 12, 9:38 am, "Ken Slovak - [MVP - Outlook]"
<kenslo...[ at ]mvps.org> wrote:
[Quoted Text]
> 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
>
> "Exchnerd" <sanjur...[ at ]gmail.com> wrote in message
>
> news:4a6092e7-ae6c-446e-89fa-c0350c0f6416[ at ]w1g2000prk.googlegroups.com...
>
> > 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

Re: Trapping "Enter" key in _CommandBarComboBoxEvents
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 11/12/2008 6:48:04 PM
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


"Exchnerd" <sanjuraja[ at ]gmail.com> wrote in message
news:efa1b7fc-f8a1-48eb-8da2-13771a19f721[ at ]v22g2000pro.googlegroups.com...
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.

Re: Trapping "Enter" key in _CommandBarComboBoxEvents
Exchnerd <sanjuraja[ at ]gmail.com> 11/12/2008 7:19:14 PM
On Nov 12, 1:48 pm, "Ken Slovak - [MVP - Outlook]"
<kenslo...[ at ]mvps.org> wrote:
[Quoted Text]
> 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
>
> "Exchnerd" <sanjur...[ at ]gmail.com> wrote in message
>
> news:efa1b7fc-f8a1-48eb-8da2-13771a19f721[ at ]v22g2000pro.googlegroups.com...
> 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?
Re: Trapping "Enter" key in _CommandBarComboBoxEvents
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 11/12/2008 9:16:01 PM
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


"Exchnerd" <sanjuraja[ at ]gmail.com> wrote in message
news:fddba2dc-a1a0-416d-86ab-7528c15b0f3f[ at ]c22g2000prc.googlegroups.com...
<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?

Re: Trapping "Enter" key in _CommandBarComboBoxEvents
Exchnerd <sanjuraja[ at ]gmail.com> 11/12/2008 9:33:46 PM
On Nov 12, 4:16 pm, "Ken Slovak - [MVP - Outlook]"
<kenslo...[ at ]mvps.org> wrote:
[Quoted Text]
> 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
>
> "Exchnerd" <sanjur...[ at ]gmail.com> wrote in message
>
> news:fddba2dc-a1a0-416d-86ab-7528c15b0f3f[ at ]c22g2000prc.googlegroups.com...
> <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
Re: Trapping "Enter" key in _CommandBarComboBoxEvents
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 11/13/2008 2:38:46 PM
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


"Exchnerd" <sanjuraja[ at ]gmail.com> wrote in message
news:1e6d560e-fa74-4ee7-bb71-cf99d0be6f5f[ at ]35g2000pry.googlegroups.com...
<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

Re: Trapping "Enter" key in _CommandBarComboBoxEvents
Exchnerd <sanjuraja[ at ]gmail.com> 11/13/2008 3:45:26 PM
On Nov 13, 9:38 am, "Ken Slovak - [MVP - Outlook]"
<kenslo...[ at ]mvps.org> wrote:
[Quoted Text]
> 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
>
> "Exchnerd" <sanjur...[ at ]gmail.com> wrote in message
>
> news:1e6d560e-fa74-4ee7-bb71-cf99d0be6f5f[ at ]35g2000pry.googlegroups.com...
> <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
Re: Trapping "Enter" key in _CommandBarComboBoxEvents
Exchnerd <sanjuraja[ at ]gmail.com> 11/13/2008 3:55:37 PM
On Nov 13, 10:45 am, Exchnerd <sanjur...[ at ]gmail.com> wrote:
[Quoted Text]
> On Nov 13, 9:38 am, "Ken Slovak - [MVP - Outlook]"
>
>
>
> <kenslo...[ at ]mvps.org> wrote:
> > 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
>
> > "Exchnerd" <sanjur...[ at ]gmail.com> wrote in message
>
> >news:1e6d560e-fa74-4ee7-bb71-cf99d0be6f5f[ at ]35g2000pry.googlegroups.com...
> > <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?
Re: Trapping "Enter" key in _CommandBarComboBoxEvents
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 11/13/2008 8:46:37 PM
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


"Exchnerd" <sanjuraja[ at ]gmail.com> wrote in message
news:36fbdf74-5253-44dd-9e49-e060c2e342cd[ at ]u29g2000pro.googlegroups.com...
On Nov 13, 10:45 am, Exchnerd <sanjur...[ at ]gmail.com> wrote:
<anip>
[Quoted Text]
> 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?

Re: Trapping "Enter" key in _CommandBarComboBoxEvents
Exchnerd <sanjuraja[ at ]gmail.com> 11/14/2008 12:48:17 AM
On Nov 13, 3:46 pm, "Ken Slovak - [MVP - Outlook]"
<kenslo...[ at ]mvps.org> wrote:
[Quoted Text]
> 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
>
> "Exchnerd" <sanjur...[ at ]gmail.com> wrote in message
>
> news:36fbdf74-5253-44dd-9e49-e060c2e342cd[ at ]u29g2000pro.googlegroups.com...
> On Nov 13, 10:45 am, Exchnerd <sanjur...[ at ]gmail.com> wrote:
> <anip>> 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?

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.!
Re: Trapping "Enter" key in _CommandBarComboBoxEvents
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 11/14/2008 2:08:52 PM
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.

--
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" <sanjuraja[ at ]gmail.com> wrote in message
news:00325e3a-449d-4639-96f4-5c76183ce99c[ at ]w39g2000prb.googlegroups.com...
<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.!

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net