PC Review


Reply
Thread Tools Rate Thread

Commandbar in special Inspectors

 
 
Hans-Joerg Propach
Guest
Posts: n/a
 
      25th Jul 2003
I develope an Outlook Com-Addin that needs a Commandbar with some
CommandbarButtons in mail- and contact-inspectors.
I use the NewInspectorEvent, check the type of the item and add the
commandbar and commandbarbuttons with temporary=true, so they are visible
only in this inspector.
Because of "temporary=true" i have to check every new inspector if the
commandbar already exists (normaly not) and add the bar and the buttons.
My problem: I have a global Object Commandbarbutton declared "withevents",
and everytime i get a newinspectorevent, iset it to the new created
commandbarbutton so i can get the users mouseclick. But when the user opens
several inspector windows, how can i be sure that the different
commandbarbuttons (remember, i create them often because of temporary=true)
fire the event ? Is every commandbarbutton with the same tag the same
commandbarbutton ???
On my dev-System everything works fine, but i can't believe it will work in
a user enviroment (user opens mail, opens word, opens another mail etc., and
then every of my for every inspector created commandbarbuttons fires the
event ???).

Thank for any idea,

Hans-Jörg "Keke" Propach, GIID


 
Reply With Quote
 
 
 
 
Hans-Jörg Propach
Guest
Posts: n/a
 
      28th Jul 2003
Your answer is what I expected. It's a little bit funny to create an object
for every inspector by the way. Another idea was to create a common
commandbar for all inspectors (temporary=false), but how remove the
commandbar when the user uninstalls the addin? The inspectors commandbar may
be not availble at this time. Next idea, set a handler to one of the open
inspectors close-events (withevents inspectorhandler as outlook.inspector,
when the inspectors.newinspector fires, set inspectorhandler = inspector).
When this inspector closes, check if other inspectors are open. If yes,
remapp the handler to an other inspector (find one through the inspectors
collection), else delete the commandbar and set the inspectorhandler =
nothing. So far, so good: It works fine (I thought). But when I close an
inspector and set the handler to an stickynote-inspector, the close-event
of the sticky-inspector doesn't fire if I close it. Instead, when I then
close Outlook, it says it could not save the changes in the sticky-note
(which seems to be already closed). After that, when I close the
error-message, the event fires (before Outlook goes). I don't tried to
access a commandbar from within the sticky-note-inspector (because that
could not work), really.
Good idea so far, but ...
Any experience like that ???
"Ken Slovak - [MVP - Outlook]" <(E-Mail Removed)> schrieb im Newsbeitrag
news:%(E-Mail Removed)...
> Use an Inspector wrapper similar to the Explorer wrapper used in
> ItemsCB, create the toolbar in your code and handle the button press
> in the Inspector wrapper. You'd declare a WithEvents button in each
> Inspector class object in the wrapper collection.
>
> Each button should have its own unique Tag or otherwise each button
> that is created will fire when one of the buttons is pressed.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Lead Author, Professional Outlook 2000 Programming, Wrox Press
> Lead Author, Beginning VB 6 Application Development, Wrox Press
> Attachment Options
> http://www.slovaktech.com/attachmentoptions.htm
> Extended Reminders
> http://www.slovaktech.com/extendedreminders.htm
>
>
> "Hans-Joerg Propach" <(E-Mail Removed)> wrote in message
> news:#(E-Mail Removed)...
> > I develope an Outlook Com-Addin that needs a Commandbar with some
> > CommandbarButtons in mail- and contact-inspectors.
> > I use the NewInspectorEvent, check the type of the item and add the
> > commandbar and commandbarbuttons with temporary=true, so they are

> visible
> > only in this inspector.
> > Because of "temporary=true" i have to check every new inspector if

> the
> > commandbar already exists (normaly not) and add the bar and the

> buttons.
> > My problem: I have a global Object Commandbarbutton declared

> "withevents",
> > and everytime i get a newinspectorevent, iset it to the new created
> > commandbarbutton so i can get the users mouseclick. But when the

> user opens
> > several inspector windows, how can i be sure that the different
> > commandbarbuttons (remember, i create them often because of

> temporary=true)
> > fire the event ? Is every commandbarbutton with the same tag the

> same
> > commandbarbutton ???
> > On my dev-System everything works fine, but i can't believe it will

> work in
> > a user enviroment (user opens mail, opens word, opens another mail

> etc., and
> > then every of my for every inspector created commandbarbuttons fires

> the
> > event ???).
> >
> > Thank for any idea,
> >
> > Hans-Jörg "Keke" Propach, GIID
> >
> >

>
>



 
Reply With Quote
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      28th Jul 2003
I don't think using a separate object for each inspector is funny, this is
exactly how classes are supposed to be used, even though VB doesn't exactly
encourage their use. Why not steal the working code from ItemsCB
(http://www.microeye.com)?
Create the command bars as temporary (CommandBars.Add(Temporary:=true)),
there won't be anything to remove.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Hans-Jörg Propach" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Your answer is what I expected. It's a little bit funny to create an

object
> for every inspector by the way. Another idea was to create a common
> commandbar for all inspectors (temporary=false), but how remove the
> commandbar when the user uninstalls the addin? The inspectors commandbar

may
> be not availble at this time. Next idea, set a handler to one of the open
> inspectors close-events (withevents inspectorhandler as outlook.inspector,
> when the inspectors.newinspector fires, set inspectorhandler = inspector).
> When this inspector closes, check if other inspectors are open. If yes,
> remapp the handler to an other inspector (find one through the inspectors
> collection), else delete the commandbar and set the inspectorhandler =
> nothing. So far, so good: It works fine (I thought). But when I close an
> inspector and set the handler to an stickynote-inspector, the close-event
> of the sticky-inspector doesn't fire if I close it. Instead, when I then
> close Outlook, it says it could not save the changes in the sticky-note
> (which seems to be already closed). After that, when I close the
> error-message, the event fires (before Outlook goes). I don't tried to
> access a commandbar from within the sticky-note-inspector (because that
> could not work), really.
> Good idea so far, but ...
> Any experience like that ???
> "Ken Slovak - [MVP - Outlook]" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:%(E-Mail Removed)...
> > Use an Inspector wrapper similar to the Explorer wrapper used in
> > ItemsCB, create the toolbar in your code and handle the button press
> > in the Inspector wrapper. You'd declare a WithEvents button in each
> > Inspector class object in the wrapper collection.
> >
> > Each button should have its own unique Tag or otherwise each button
> > that is created will fire when one of the buttons is pressed.
> >
> > --
> > Ken Slovak
> > [MVP - Outlook]
> > http://www.slovaktech.com
> > Lead Author, Professional Outlook 2000 Programming, Wrox Press
> > Lead Author, Beginning VB 6 Application Development, Wrox Press
> > Attachment Options
> > http://www.slovaktech.com/attachmentoptions.htm
> > Extended Reminders
> > http://www.slovaktech.com/extendedreminders.htm
> >
> >
> > "Hans-Joerg Propach" <(E-Mail Removed)> wrote in message
> > news:#(E-Mail Removed)...
> > > I develope an Outlook Com-Addin that needs a Commandbar with some
> > > CommandbarButtons in mail- and contact-inspectors.
> > > I use the NewInspectorEvent, check the type of the item and add the
> > > commandbar and commandbarbuttons with temporary=true, so they are

> > visible
> > > only in this inspector.
> > > Because of "temporary=true" i have to check every new inspector if

> > the
> > > commandbar already exists (normaly not) and add the bar and the

> > buttons.
> > > My problem: I have a global Object Commandbarbutton declared

> > "withevents",
> > > and everytime i get a newinspectorevent, iset it to the new created
> > > commandbarbutton so i can get the users mouseclick. But when the

> > user opens
> > > several inspector windows, how can i be sure that the different
> > > commandbarbuttons (remember, i create them often because of

> > temporary=true)
> > > fire the event ? Is every commandbarbutton with the same tag the

> > same
> > > commandbarbutton ???
> > > On my dev-System everything works fine, but i can't believe it will

> > work in
> > > a user enviroment (user opens mail, opens word, opens another mail

> > etc., and
> > > then every of my for every inspector created commandbarbuttons fires

> > the
> > > event ???).
> > >
> > > Thank for any idea,
> > >
> > > Hans-Jörg "Keke" Propach, GIID
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Hans-Joerg Propach
Guest
Posts: n/a
 
      28th Jul 2003
Funny is that there is so much code in my project for such things like
Commandbars, User-Options, ...
And then, your real work, your Application, is less code than the things
around.
Maybe my problem is to say "OK, let us add some objects, so what" cause 16
years ago when I started with Pascal and Modula-2, I had to care about every
kbyte.
OK, we're in 2003, my PC has 400MB, let's go.
By the way, I think the Code in ItemsCB is a good idea for an
Inspector-Wrapper, and because I own the Development-Handbook Outlook2002
from Randy Byrne I think it's ok to use it :-)
Next problem might be the "security update" from MS, so maybe you earn 182,-
? in about a month or two...

Thank's so far,
H.-J. "Keke" Propach, GIID

"Dmitry Streblechenko" <(E-Mail Removed)> schrieb im Newsbeitrag
news:#(E-Mail Removed)...
> I don't think using a separate object for each inspector is funny, this is
> exactly how classes are supposed to be used, even though VB doesn't

exactly
> encourage their use. Why not steal the working code from ItemsCB
> (http://www.microeye.com)?
> Create the command bars as temporary (CommandBars.Add(Temporary:=true)),
> there won't be anything to remove.
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
>
> "Hans-Jörg Propach" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Your answer is what I expected. It's a little bit funny to create an

> object
> > for every inspector by the way. Another idea was to create a common
> > commandbar for all inspectors (temporary=false), but how remove the
> > commandbar when the user uninstalls the addin? The inspectors commandbar

> may
> > be not availble at this time. Next idea, set a handler to one of the

open
> > inspectors close-events (withevents inspectorhandler as

outlook.inspector,
> > when the inspectors.newinspector fires, set inspectorhandler =

inspector).
> > When this inspector closes, check if other inspectors are open. If yes,
> > remapp the handler to an other inspector (find one through the

inspectors
> > collection), else delete the commandbar and set the inspectorhandler =
> > nothing. So far, so good: It works fine (I thought). But when I close an
> > inspector and set the handler to an stickynote-inspector, the

close-event
> > of the sticky-inspector doesn't fire if I close it. Instead, when I then
> > close Outlook, it says it could not save the changes in the sticky-note
> > (which seems to be already closed). After that, when I close the
> > error-message, the event fires (before Outlook goes). I don't tried to
> > access a commandbar from within the sticky-note-inspector (because that
> > could not work), really.
> > Good idea so far, but ...
> > Any experience like that ???
> > "Ken Slovak - [MVP - Outlook]" <(E-Mail Removed)> schrieb im

Newsbeitrag
> > news:%(E-Mail Removed)...
> > > Use an Inspector wrapper similar to the Explorer wrapper used in
> > > ItemsCB, create the toolbar in your code and handle the button press
> > > in the Inspector wrapper. You'd declare a WithEvents button in each
> > > Inspector class object in the wrapper collection.
> > >
> > > Each button should have its own unique Tag or otherwise each button
> > > that is created will fire when one of the buttons is pressed.
> > >
> > > --
> > > Ken Slovak
> > > [MVP - Outlook]
> > > http://www.slovaktech.com
> > > Lead Author, Professional Outlook 2000 Programming, Wrox Press
> > > Lead Author, Beginning VB 6 Application Development, Wrox Press
> > > Attachment Options
> > > http://www.slovaktech.com/attachmentoptions.htm
> > > Extended Reminders
> > > http://www.slovaktech.com/extendedreminders.htm
> > >
> > >
> > > "Hans-Joerg Propach" <(E-Mail Removed)> wrote in message
> > > news:#(E-Mail Removed)...
> > > > I develope an Outlook Com-Addin that needs a Commandbar with some
> > > > CommandbarButtons in mail- and contact-inspectors.
> > > > I use the NewInspectorEvent, check the type of the item and add the
> > > > commandbar and commandbarbuttons with temporary=true, so they are
> > > visible
> > > > only in this inspector.
> > > > Because of "temporary=true" i have to check every new inspector if
> > > the
> > > > commandbar already exists (normaly not) and add the bar and the
> > > buttons.
> > > > My problem: I have a global Object Commandbarbutton declared
> > > "withevents",
> > > > and everytime i get a newinspectorevent, iset it to the new created
> > > > commandbarbutton so i can get the users mouseclick. But when the
> > > user opens
> > > > several inspector windows, how can i be sure that the different
> > > > commandbarbuttons (remember, i create them often because of
> > > temporary=true)
> > > > fire the event ? Is every commandbarbutton with the same tag the
> > > same
> > > > commandbarbutton ???
> > > > On my dev-System everything works fine, but i can't believe it will
> > > work in
> > > > a user enviroment (user opens mail, opens word, opens another mail
> > > etc., and
> > > > then every of my for every inspector created commandbarbuttons fires
> > > the
> > > > event ???).
> > > >
> > > > Thank for any idea,
> > > >
> > > > Hans-Jörg "Keke" Propach, GIID
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      29th Jul 2003
There isn't much overhead when classes are used - only per-instance data is
allocated (member variables) and virtual functions table (v-table, I don't
know if VB supports that).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Hans-Joerg Propach" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Funny is that there is so much code in my project for such things like
> Commandbars, User-Options, ...
> And then, your real work, your Application, is less code than the things
> around.
> Maybe my problem is to say "OK, let us add some objects, so what" cause 16
> years ago when I started with Pascal and Modula-2, I had to care about

every
> kbyte.
> OK, we're in 2003, my PC has 400MB, let's go.
> By the way, I think the Code in ItemsCB is a good idea for an
> Inspector-Wrapper, and because I own the Development-Handbook Outlook2002
> from Randy Byrne I think it's ok to use it :-)
> Next problem might be the "security update" from MS, so maybe you earn

182,-
> ? in about a month or two...
>
> Thank's so far,
> H.-J. "Keke" Propach, GIID
>
> "Dmitry Streblechenko" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:#(E-Mail Removed)...
> > I don't think using a separate object for each inspector is funny, this

is
> > exactly how classes are supposed to be used, even though VB doesn't

> exactly
> > encourage their use. Why not steal the working code from ItemsCB
> > (http://www.microeye.com)?
> > Create the command bars as temporary (CommandBars.Add(Temporary:=true)),
> > there won't be anything to remove.
> >
> > Dmitry Streblechenko (MVP)
> > http://www.dimastr.com/
> > OutlookSpy - Outlook, CDO
> > and MAPI Developer Tool
> >
> >
> > "Hans-Jörg Propach" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Your answer is what I expected. It's a little bit funny to create an

> > object
> > > for every inspector by the way. Another idea was to create a common
> > > commandbar for all inspectors (temporary=false), but how remove the
> > > commandbar when the user uninstalls the addin? The inspectors

commandbar
> > may
> > > be not availble at this time. Next idea, set a handler to one of the

> open
> > > inspectors close-events (withevents inspectorhandler as

> outlook.inspector,
> > > when the inspectors.newinspector fires, set inspectorhandler =

> inspector).
> > > When this inspector closes, check if other inspectors are open. If

yes,
> > > remapp the handler to an other inspector (find one through the

> inspectors
> > > collection), else delete the commandbar and set the inspectorhandler =
> > > nothing. So far, so good: It works fine (I thought). But when I close

an
> > > inspector and set the handler to an stickynote-inspector, the

> close-event
> > > of the sticky-inspector doesn't fire if I close it. Instead, when I

then
> > > close Outlook, it says it could not save the changes in the

sticky-note
> > > (which seems to be already closed). After that, when I close the
> > > error-message, the event fires (before Outlook goes). I don't tried to
> > > access a commandbar from within the sticky-note-inspector (because

that
> > > could not work), really.
> > > Good idea so far, but ...
> > > Any experience like that ???
> > > "Ken Slovak - [MVP - Outlook]" <(E-Mail Removed)> schrieb im

> Newsbeitrag
> > > news:%(E-Mail Removed)...
> > > > Use an Inspector wrapper similar to the Explorer wrapper used in
> > > > ItemsCB, create the toolbar in your code and handle the button press
> > > > in the Inspector wrapper. You'd declare a WithEvents button in each
> > > > Inspector class object in the wrapper collection.
> > > >
> > > > Each button should have its own unique Tag or otherwise each button
> > > > that is created will fire when one of the buttons is pressed.
> > > >
> > > > --
> > > > Ken Slovak
> > > > [MVP - Outlook]
> > > > http://www.slovaktech.com
> > > > Lead Author, Professional Outlook 2000 Programming, Wrox Press
> > > > Lead Author, Beginning VB 6 Application Development, Wrox Press
> > > > Attachment Options
> > > > http://www.slovaktech.com/attachmentoptions.htm
> > > > Extended Reminders
> > > > http://www.slovaktech.com/extendedreminders.htm
> > > >
> > > >
> > > > "Hans-Joerg Propach" <(E-Mail Removed)> wrote in message
> > > > news:#(E-Mail Removed)...
> > > > > I develope an Outlook Com-Addin that needs a Commandbar with some
> > > > > CommandbarButtons in mail- and contact-inspectors.
> > > > > I use the NewInspectorEvent, check the type of the item and add

the
> > > > > commandbar and commandbarbuttons with temporary=true, so they are
> > > > visible
> > > > > only in this inspector.
> > > > > Because of "temporary=true" i have to check every new inspector if
> > > > the
> > > > > commandbar already exists (normaly not) and add the bar and the
> > > > buttons.
> > > > > My problem: I have a global Object Commandbarbutton declared
> > > > "withevents",
> > > > > and everytime i get a newinspectorevent, iset it to the new

created
> > > > > commandbarbutton so i can get the users mouseclick. But when the
> > > > user opens
> > > > > several inspector windows, how can i be sure that the different
> > > > > commandbarbuttons (remember, i create them often because of
> > > > temporary=true)
> > > > > fire the event ? Is every commandbarbutton with the same tag the
> > > > same
> > > > > commandbarbutton ???
> > > > > On my dev-System everything works fine, but i can't believe it

will
> > > > work in
> > > > > a user enviroment (user opens mail, opens word, opens another mail
> > > > etc., and
> > > > > then every of my for every inspector created commandbarbuttons

fires
> > > > the
> > > > > event ???).
> > > > >
> > > > > Thank for any idea,
> > > > >
> > > > > Hans-Jörg "Keke" Propach, GIID
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
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
AddHandler to a button on a new inspectors commandbar Steffen Grellmann Microsoft Outlook Program Addins 6 21st Jul 2008 08:49 PM
Errors when using Inspectors Yoav Microsoft Outlook Calendar 1 23rd Mar 2006 02:47 PM
Inspectors =?Utf-8?B?QXBwaWFuIEJyZW5kYW4=?= Microsoft Outlook Form Programming 6 19th Aug 2004 08:14 PM
Word as Email Editor/Inspectors/Commandbar David McNealey Microsoft Outlook Program Addins 5 26th Nov 2003 03:47 PM
How can I know which is the currentitem if I don´t have Inspectors? Óscar Salgado Sánchez Microsoft Outlook VBA Programming 1 7th Oct 2003 01:21 AM


Features
 

Advertising
 

Newsgroups
 


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