PC Review


Reply
Thread Tools Rate Thread

delete e-mail in inspector problem

 
 
Mark Smith
Guest
Posts: n/a
 
      27th Jun 2005
My addin places a tool bar with a button on each inspector window. As per
previous advice I am using the Item Close event rather than the Inspector
Close event to delete my toolbar wrapper (ToolBar).

If the user uses the previous and next buttons, the Item close event fires
and the ToolBar attached to the inspector gets deleted. Then a New
Inspector event fires and a new ToolBar item is created and attached. On
the other hand, If the user deletes the item, the Item Close event fires,
but no New Inspector event fires. Thus the tool bar gets orphaned and no
longer functions.

So I tried to use the Inspector Close event instead of the Item Close event.
This allows the button to continue functioning after the user deletes an
item. Unfortunately this leaves extra ToolBars around that aren't needed.
In and of itself, this is not a big deal. The problem is that if the user
has used the previous or next buttons or deleted items, when the button is
clicked, the button handler fires for each ToolBar, resulting in the same
operation occuring on that item many times.

I have considered doing something with the tag name to make sure that a
pressing a given button only results in one action, but this seems like a
less than optimal solution. Other than that I can't think of anything. If
there is a better way, I would love to hear it. Any ideas?

Thank you,
Mark Smith


 
Reply With Quote
 
 
 
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      28th Jun 2005
Any Inspector or Explorer button should have a unique Tag property. That
prevents what you are describing.

Next and Previous are problems. In fact in certain versions of Outlook you
don't even get a Close event on the Item when they are used. I always
backstop using both Inspector and Item Close since other things may also
change the order in which they fire or prevent one or the other from firing.
Such things as whether or not WordMail is being used and whether or not Send
is pressed can affect that.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Mark Smith" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> My addin places a tool bar with a button on each inspector window. As per
> previous advice I am using the Item Close event rather than the Inspector
> Close event to delete my toolbar wrapper (ToolBar).
>
> If the user uses the previous and next buttons, the Item close event fires
> and the ToolBar attached to the inspector gets deleted. Then a New
> Inspector event fires and a new ToolBar item is created and attached. On
> the other hand, If the user deletes the item, the Item Close event fires,
> but no New Inspector event fires. Thus the tool bar gets orphaned and no
> longer functions.
>
> So I tried to use the Inspector Close event instead of the Item Close
> event. This allows the button to continue functioning after the user
> deletes an item. Unfortunately this leaves extra ToolBars around that
> aren't needed. In and of itself, this is not a big deal. The problem is
> that if the user has used the previous or next buttons or deleted items,
> when the button is clicked, the button handler fires for each ToolBar,
> resulting in the same operation occuring on that item many times.
>
> I have considered doing something with the tag name to make sure that a
> pressing a given button only results in one action, but this seems like a
> less than optimal solution. Other than that I can't think of anything.
> If there is a better way, I would love to hear it. Any ideas?
>
> Thank you,
> Mark Smith
>


 
Reply With Quote
 
 
 
 
Mark Smith
Guest
Posts: n/a
 
      28th Jun 2005
The main problem I am getting is that when the user deletes the item I get a
close item event but no new inspector event. If I use the close item event
rather than the inspector event, I have no way of properly cleaning up
resources while keeping the toolbar working.

Mark

"Ken Slovak - [MVP - Outlook]" <(E-Mail Removed)> wrote in message
news:OQCjqX%(E-Mail Removed)...
> Any Inspector or Explorer button should have a unique Tag property. That
> prevents what you are describing.
>
> Next and Previous are problems. In fact in certain versions of Outlook you
> don't even get a Close event on the Item when they are used. I always
> backstop using both Inspector and Item Close since other things may also
> change the order in which they fire or prevent one or the other from
> firing. Such things as whether or not WordMail is being used and whether
> or not Send is pressed can affect that.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "Mark Smith" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> My addin places a tool bar with a button on each inspector window. As
>> per previous advice I am using the Item Close event rather than the
>> Inspector Close event to delete my toolbar wrapper (ToolBar).
>>
>> If the user uses the previous and next buttons, the Item close event
>> fires and the ToolBar attached to the inspector gets deleted. Then a New
>> Inspector event fires and a new ToolBar item is created and attached. On
>> the other hand, If the user deletes the item, the Item Close event fires,
>> but no New Inspector event fires. Thus the tool bar gets orphaned and no
>> longer functions.
>>
>> So I tried to use the Inspector Close event instead of the Item Close
>> event. This allows the button to continue functioning after the user
>> deletes an item. Unfortunately this leaves extra ToolBars around that
>> aren't needed. In and of itself, this is not a big deal. The problem is
>> that if the user has used the previous or next buttons or deleted items,
>> when the button is clicked, the button handler fires for each ToolBar,
>> resulting in the same operation occuring on that item many times.
>>
>> I have considered doing something with the tag name to make sure that a
>> pressing a given button only results in one action, but this seems like a
>> less than optimal solution. Other than that I can't think of anything.
>> If there is a better way, I would love to hear it. Any ideas?
>>
>> Thank you,
>> Mark Smith
>>

>



 
Reply With Quote
 
Mark Smith
Guest
Posts: n/a
 
      28th Jun 2005
Now that I think about it, I'm not sure how having a unique tag name will
help. I already do have a unique tag name created for each button. But
because of how the inspectors work, I have one button which may be attached
to several inspectors (because of the use of the previous and next buttons).
Thus when the one button is pressed, all inspectors' event sinks fire. And
because there is only one actual button, there is only one tag name to test
against, not one for each inspector. Perhaps I need to set up my buttons
differently? The way I am currently doing it is that when a new inspector
event occurs I search for the toolbar and button, and if they already exist,
I attach to the existing one. If it doesn't, then I create it. This worked
fine as long as I was using the item close event, but if I switch to the
inspector close event I get this problem.

Mark

"Ken Slovak - [MVP - Outlook]" <(E-Mail Removed)> wrote in message
news:OQCjqX%(E-Mail Removed)...
> Any Inspector or Explorer button should have a unique Tag property. That
> prevents what you are describing.
>
> Next and Previous are problems. In fact in certain versions of Outlook you
> don't even get a Close event on the Item when they are used. I always
> backstop using both Inspector and Item Close since other things may also
> change the order in which they fire or prevent one or the other from
> firing. Such things as whether or not WordMail is being used and whether
> or not Send is pressed can affect that.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "Mark Smith" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> My addin places a tool bar with a button on each inspector window. As
>> per previous advice I am using the Item Close event rather than the
>> Inspector Close event to delete my toolbar wrapper (ToolBar).
>>
>> If the user uses the previous and next buttons, the Item close event
>> fires and the ToolBar attached to the inspector gets deleted. Then a New
>> Inspector event fires and a new ToolBar item is created and attached. On
>> the other hand, If the user deletes the item, the Item Close event fires,
>> but no New Inspector event fires. Thus the tool bar gets orphaned and no
>> longer functions.
>>
>> So I tried to use the Inspector Close event instead of the Item Close
>> event. This allows the button to continue functioning after the user
>> deletes an item. Unfortunately this leaves extra ToolBars around that
>> aren't needed. In and of itself, this is not a big deal. The problem is
>> that if the user has used the previous or next buttons or deleted items,
>> when the button is clicked, the button handler fires for each ToolBar,
>> resulting in the same operation occuring on that item many times.
>>
>> I have considered doing something with the tag name to make sure that a
>> pressing a given button only results in one action, but this seems like a
>> less than optimal solution. Other than that I can't think of anything.
>> If there is a better way, I would love to hear it. Any ideas?
>>
>> Thank you,
>> Mark Smith
>>

>



 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      29th Jun 2005
The way to handle multiple Inspectors is by using a collection of them
backed with a wrapper class that handles the events in each Inspector. With
that methodology and use of unique tags for the buttons in each Inspector
you avoid the problem of a button click firing in more than one instance of
a button.

See http://www.slovaktech.com/code_sampl...spectorWrapper for an
example of an Inspector wrapper done in VB 6. A C# example can be found at
www.outlookcode.com.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Mark Smith" <(E-Mail Removed)> wrote in message
news:e$(E-Mail Removed)...
> Now that I think about it, I'm not sure how having a unique tag name will
> help. I already do have a unique tag name created for each button. But
> because of how the inspectors work, I have one button which may be
> attached to several inspectors (because of the use of the previous and
> next buttons). Thus when the one button is pressed, all inspectors' event
> sinks fire. And because there is only one actual button, there is only
> one tag name to test against, not one for each inspector. Perhaps I need
> to set up my buttons differently? The way I am currently doing it is that
> when a new inspector event occurs I search for the toolbar and button, and
> if they already exist, I attach to the existing one. If it doesn't, then
> I create it. This worked fine as long as I was using the item close
> event, but if I switch to the inspector close event I get this problem.
>
> Mark


 
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 wrapper and Inspector close not fireing marcus.lambert@gmail.com Microsoft Outlook Program Addins 1 20th Jun 2008 01:53 PM
How do I stay in mail inspector window when I delete a mail item =?Utf-8?B?UGF1bA==?= Microsoft Outlook Discussion 1 6th Jul 2006 04:30 PM
Help! Inspector.Close is fired before Inspector.Activate handler finishes Sergey Anchipolevsky Microsoft Outlook Program Addins 8 9th Feb 2006 10:51 AM
Inspector wrapper and Inspector::OnClose event Henry Gusakovsky Microsoft Outlook Program Addins 2 27th May 2004 05:08 PM
Minimize an Inspector over another Inspector. George Microsoft Outlook Program Addins 4 27th May 2004 08:39 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:05 PM.