|
|
I have a mature application where I use Inspector.Activate event as the place where I add a Button to a Contact when a contact is opened.
This is the code section I am concerned with... Set objBar = objInsp.CommandBars.item("Standard") If objButton Is Nothing Then Set objButton = objBar.Controls.Add(msoControlButton, , , , True)
It works just fine on the first contact opened but when I open subsequent contacts while the first is still open then the "If objButton Is Nothing" test bypasses adding a new button.
Is there a better wrapper object or event that I should move my UI creation code to, or is there some way to track new inspectors?
-mike
|
|
For having unique buttons I always add a counter to the name of a button.
-- Best regards Michael Bauer - MVP Outlook
: Outlook Categories? Category Manager Is Your Tool : VBOffice Reporter for Data Analysis & Reporting : <http://www.vboffice.net/product.html?pub=6&lang=en>
Am Tue, 16 Dec 2008 23:01:35 -0500 schrieb Mike:
[Quoted Text] > I have a mature application where I use Inspector.Activate event as the > place where I add a Button to a Contact when a contact is opened. > > This is the code section I am concerned with... > Set objBar = objInsp.CommandBars.item("Standard") > If objButton Is Nothing Then > Set objButton = objBar.Controls.Add(msoControlButton, , , , True) > > It works just fine on the first contact opened but when I open subsequent
contacts while > the first is still open then the "If objButton Is Nothing" test bypasses adding a new > button. > > Is there a better wrapper object or event that I should move my UI creation code to, or is > there some way to track new inspectors? > > -mike
|
|
|
[Quoted Text] >Am Tue, 16 Dec 2008 23:01:35 -0500 schrieb Mike:
>> I have a mature application where I use Inspector.Activate event as the >> place where I add a Button to a Contact when a contact is opened.
>> This is the code section I am concerned with... >> Set objBar = objInsp.CommandBars.item("Standard") >> If objButton Is Nothing Then >> Set objButton = objBar.Controls.Add(msoControlButton, , , , True)
>> It works just fine on the first contact opened but when I open subsequent >>contacts while the first is still open then the "If objButton Is Nothing" test bypasses >adding a new button.
>> Is there a better wrapper object or event that I should move my UI >creation code to, or is there some way to track new inspectors?
>> -mike
"Michael Bauer [MVP - Outlook]" <mb[ at ]mvps.org> wrote:
>For having unique buttons I always add a counter to the name of a button. >Best regards >Michael Bauer - MVP Outlook
Hi Michael, How do you test if it safe to add a new button when testing for the button object returns True?
-mike
|
|
I don't understand the question. If the button exists, it exists.
-- Best regards Michael Bauer - MVP Outlook
: Outlook Categories? Category Manager Is Your Tool : VBOffice Reporter for Data Analysis & Reporting : <http://www.vboffice.net/product.html?pub=6&lang=en>
Am Wed, 17 Dec 2008 21:35:26 -0500 schrieb Mike:
[Quoted Text] >>Am Tue, 16 Dec 2008 23:01:35 -0500 schrieb Mike: > >>> I have a mature application where I use Inspector.Activate event as the >>> place where I add a Button to a Contact when a contact is opened. > >>> This is the code section I am concerned with... >>> Set objBar = objInsp.CommandBars.item("Standard") >>> If objButton Is Nothing Then >>> Set objButton = objBar.Controls.Add(msoControlButton, , , , True) > >>> It works just fine on the first contact opened but when I open
subsequent >>>contacts while the first is still open then the "If objButton Is Nothing" test bypasses >>adding a new button. > >>> Is there a better wrapper object or event that I should move my UI >>creation code to, or is there some way to track new inspectors? > >>> -mike > > > "Michael Bauer [MVP - Outlook]" <mb[ at ]mvps.org> wrote: > >>For having unique buttons I always add a counter to the name of a button. >>Best regards >>Michael Bauer - MVP Outlook > > Hi Michael, > How do you test if it safe to add a new button when testing for the button object returns > True? > > -mike
|
|
"Michael Bauer [MVP - Outlook]" <mb[ at ]mvps.org> wrote:
[Quoted Text] >I don't understand the question. If the button exists, it exists.
It exists on the first inspector but testing for existence when new inspectors (contacts) activate I get a false *exists* and never get a get a new button on secondary inspectors. If the all inspectors are closed then it works when I open a new one.
This was my original post:
I have a mature application where I use Inspector.Activate event as the place where I add a Button to a Contact when a contact is opened.
This is the code section I am concerned with... Set objBar = objInsp.CommandBars.item("Standard") If objButton Is Nothing Then Set objButton = objBar.Controls.Add(msoControlButton, , , , True)
It works just fine on the first contact opened but when I open subsequent contacts while the first is still open then the "If objButton Is Nothing" test bypasses adding a new button.
Is there a better wrapper object or event that I should move my UI creation code to, or is there some way to track new inspectors?
-mike
|
|
You should use an Inspector wrapper class, with a collection of wrappers to keep them alive. As Inspectors.NewInspector() fires you add the Inspector to a new wrapper class.
Then each button gets a unique Tag to make sure a click in one Inspector isn't handled in every Inspector.
You can download sample templates from my Web site in your language of choice (C#, VB.NET and VB6) at http://www.slovaktech.com/outlook_2007_templates.htm. The templates are for Outlook 2007 but they show Inspector and Explorer wrappers and various other things such as form regions, custom task panes, property pages and so on.
-- 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
"-mhd" <not_real[ at ]invalid.com> wrote in message news:mmenk4hmj6fh8qru5st5red5appu16lpfb[ at ]4ax.com... "Michael Bauer [MVP - Outlook]" <mb[ at ]mvps.org> wrote:
[Quoted Text] >I don't understand the question. If the button exists, it exists.
It exists on the first inspector but testing for existence when new inspectors (contacts) activate I get a false *exists* and never get a get a new button on secondary inspectors. If the all inspectors are closed then it works when I open a new one.
This was my original post:
I have a mature application where I use Inspector.Activate event as the place where I add a Button to a Contact when a contact is opened.
This is the code section I am concerned with... Set objBar = objInsp.CommandBars.item("Standard") If objButton Is Nothing Then Set objButton = objBar.Controls.Add(msoControlButton, , , , True)
It works just fine on the first contact opened but when I open subsequent contacts while the first is still open then the "If objButton Is Nothing" test bypasses adding a new button.
Is there a better wrapper object or event that I should move my UI creation code to, or is there some way to track new inspectors?
-mike
|
|
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> wrote:
[Quoted Text] > As Inspectors.NewInspector() fires you add the Inspector to >a new wrapper class. > >Then each button gets a unique Tag to make sure a click in one Inspector >isn't handled in every Inspector.
Thanks, that is the logic my app lacks.
-mike
|
|
|