Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: Event Handler for Folder Selected

Geek News

Event Handler for Folder Selected
"roger[ at ]rogndeb.us" <roger[ at ]rogndeb.us> 5/19/2006 10:17:43 PM
I found event handlers for regular outlook items, but how do I insert
an event handler for other folders?

I have 2 buttons on a custom toolbar, and several application specific
folders. I need to enable or disable the toolbar buttons depending on
which folder the user selects.

Re: Event Handler for Folder Selected
"roger[ at ]rogndeb.us" <roger[ at ]rogndeb.us> 5/19/2006 11:16:40 PM
Ok, I have an event handler working, but now I am trying to figure out
how to enable/disable toolbar buttons on the fly.

Re: Event Handler for Folder Selected
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 5/21/2006 5:45:03 PM
You would need a method to access the CommandBarButton objects that are your
buttons and set their Enabled property True or False as warranted by the
current state.

--
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


<roger[ at ]rogndeb.us> wrote in message
news:1148080600.564586.55990[ at ]j73g2000cwa.googlegroups.com...
[Quoted Text]
> Ok, I have an event handler working, but now I am trying to figure out
> how to enable/disable toolbar buttons on the fly.
>

Re: Event Handler for Folder Selected
"roger[ at ]rogndeb.us" <roger[ at ]rogndeb.us> 5/24/2006 6:37:28 PM

I created access to the button objects when they are created.
They're not null, but when setting the Enabled property to true, the
buttons remain
grayed out.

Re: Event Handler for Folder Selected
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 5/24/2006 7:00:54 PM
Are you getting a valid button object? Is the Enabled property returning an
error?

I've found that especially in WordMail that even if a button object is a
valid object that most of its properties and methods aren't valid even in
the button Click event handler. In those cases I have to actually
reinstantiate the button object using FindControl and then I can set
properties such as Picture and Mask and set visibility and enabled.

--
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


<roger[ at ]rogndeb.us> wrote in message
news:1148495848.843506.42530[ at ]38g2000cwa.googlegroups.com...
[Quoted Text]
>
> I created access to the button objects when they are created.
> They're not null, but when setting the Enabled property to true, the
> buttons remain
> grayed out.
>

Re: Event Handler for Folder Selected
"roger[ at ]rogndeb.us" <roger[ at ]rogndeb.us> 5/24/2006 9:19:18 PM
The return from the button.Enabled = true is true and button.Enabled =
false is false;

I will try using FindControl instead.

Re: Event Handler for Folder Selected
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 5/24/2006 9:44:11 PM
Sure it's the right button in the right Inspector or Explorer?

In my wrapper classes for Inspectors or Explorers I can set Enabled and
Visible true or false based on business logic conditions and it works.

The only time I have to re-instantiate the button objects are in WordMail
Inspectors.

--
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


<roger[ at ]rogndeb.us> wrote in message
news:1148505558.304329.208800[ at ]38g2000cwa.googlegroups.com...
[Quoted Text]
> The return from the button.Enabled = true is true and button.Enabled =
> false is false;
>
> I will try using FindControl instead.
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net