Buttons are added multiple times in New Inspector window

  • Thread starter KarthikonIT via OfficeKB.com
  • Start date
K

KarthikonIT via OfficeKB.com

Hi,
I m Creating a Plugin for MS OUtlook, I a few questions

I have added Button to New email window(ie. the window that is opened when an
email is double clicked), but multiple times buttons are
added since "Active Event" of Inspector is called again & again.

How do I prevent multiple buttons from adding up in the "New email window"?

Note:
I have assigned unique tags to the command bar buttons so that event are not
fired multiple times.


Brief description of my architecutre:
I have a class called "INspector wrapper" which implements the "Outlook::
InspectorEvents"
for every new email a new Instance of this class will be created.


I have a class called "BtnWrapper" which implments the "Office::
_CommandBarButtonEvents"
for every button created a new Instance of this class will be created.


I m adding the button in the "Active" event of Inspector.

Thanks in Advance.
 
K

Ken Slovak - [MVP - Outlook]

You can set a Boolean flag after you create your button UI the first time
and check that flag before trying to create the UI so you only do it once.
 
K

Karthik

Hi Ken,
I have already tried that, it works some times, some times i don't see
Button added to that or Multiple buttons added.


I have declared a boolean variable as a member variable of "INspector
wrapper" class which is created for every Inspector window opened.

Anything else I could try for this..

Thanks for ur reply Ken.



You can set a Boolean flag after you create your button UI the first time
and check that flag before trying to create the UI so you only do it once..

--
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 m Creating a Plugin for MS OUtlook, I a few questions
I have added Button to New email window(ie. the window that is opened when
an
email is double clicked), but multiple times buttons are
added since "Active Event" of Inspector is called again & again.
How do I prevent multiple buttons from adding up in the "New email
window"?
Note:
I have assigned unique tags to the command bar buttons so that event are
not
fired multiple times.
Brief description of my architecutre:
I have a class called "INspector wrapper" which implements the "Outlook::
InspectorEvents"
for every new email a new Instance of this class will be created.
I have a class called "BtnWrapper" which implments the "Office::
_CommandBarButtonEvents"
for every button created a new Instance of this class will be created.
I m adding the button in the "Active" event of Inspector.
Thanks in Advance.

- Show quoted text -
 
K

KarthikonIT via OfficeKB.com

Hi,

I have already tried that it works some times, other times i don't see the
button itself or multiple button.

I created a bool variable as a member variable of "INspector wrapper" class
which is created for every New email widow opened.

Is there anything that I could try for this..

Thanks for the help.


You can set a Boolean flag after you create your button UI the first time
and check that flag before trying to create the UI so you only do it once.
Hi,
I m Creating a Plugin for MS OUtlook, I a few questions
[quoted text clipped - 24 lines]
Thanks in Advance.
 
K

Ken Slovak - [MVP - Outlook]

That should be all you need, I've never had a problem with that.

If you do need some sort of sanity check beyond that, use
CommandBar.FindControl() to see if the control exists already before
creating it again.
 

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