PC Review


Reply
Thread Tools Rate Thread

Button created only on first Inspector opened

 
 
Mike
Guest
Posts: n/a
 
      17th Dec 2008
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 subsequentcontacts 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
 
Reply With Quote
 
 
 
 
Michael Bauer [MVP - Outlook]
Guest
Posts: n/a
 
      17th Dec 2008


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:

> 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

 
Reply With Quote
 
Mike
Guest
Posts: n/a
 
      18th Dec 2008
>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]" <(E-Mail Removed)> 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
 
Reply With Quote
 
Michael Bauer [MVP - Outlook]
Guest
Posts: n/a
 
      18th Dec 2008


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:

>>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]" <(E-Mail Removed)> 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

 
Reply With Quote
 
-mhd
Guest
Posts: n/a
 
      19th Dec 2008
"Michael Bauer [MVP - Outlook]" <(E-Mail Removed)> wrote:

>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 subsequentcontacts 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
 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      19th Dec 2008
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
"Michael Bauer [MVP - Outlook]" <(E-Mail Removed)> wrote:

>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

 
Reply With Quote
 
Mike
Guest
Posts: n/a
 
      19th Dec 2008
"Ken Slovak - [MVP - Outlook]" <(E-Mail Removed)> wrote:

> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inspector doesn't change Save-Button to Send-Button when adding recipients via VB HarryWild Microsoft Outlook Program Addins 0 16th Jan 2008 10:20 AM
Adding button to mail inspector =?Utf-8?B?dHJhdmlz?= Microsoft Outlook VBA Programming 1 4th Aug 2005 05:47 PM
Issues with Inspector custom command button Mike Lindeboom Microsoft Outlook Program Addins 1 8th Oct 2004 03:15 PM
Plaxo button in preview and inspector windows. Nick Porter Microsoft Outlook VBA Programming 0 15th Sep 2004 04:44 AM
Inspector Button Steven Microsoft Outlook Program Addins 12 8th May 2004 04:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:33 PM.