Mike VE
Posts: 170
Joined: 2007-09-09
|
I have two custom toolbars - one in the Outlook Explorer and the other in the ReadMail Inspector. I want them to respond to users who use the View > Toolbars command to hide the toolbar. I have managed this with the Inspector Toolbar by storing the value of the Visible property in the Inspector Close event and setting it in the Inspector Activate event.
However, I can not get it to work with the Explorer toolbar. It re-appears every time Outlook starts. In the AddinBeginShutDown event the toolbar's visible property reads as True even though it has been hidden with the View > Toolbars menu.
Using your excellent BuiltIn Control Scanner the Visible property reads True whether the toolbar is showing or not.
What am I missing? :?: |
|
Andrei Smolin
Add-in Express team
Posts: 19138
Joined: 2006-05-11
|
Hello Mike,
The Explorer command bar component is context-sensitive so you need to change its context properties rather than Visible. Say, you can hide the toolbar if you set this.adxOlExplorerCommandBar1.ItemTypes = AddinExpress.MSO.ADXOlExplorerItemTypes.olUnknownItem;
Please see the project I developed today on a similar question - www.add-in-express.com/files/projects_pub/as/MyAddin120.zip. If you stiil need some help, please let me know.
Andrei Smolin
Add-in Express Team Leader |
|
Mike VE
Posts: 170
Joined: 2007-09-09
|
Hi Andrei
Thanks - the sample project really helped. For the record here's how I used what you showed me. The toolbar is called PrintPage1ExplorerToolbar and I have a setting in My.Settings called LastChangedVisibility.
A module level boolean to store the Explorer's visibility.
Friend LastChangedVisibility As Boolean
Save the visibility setting in the CommandBarsUpdate event
Private Sub adxOutlookEvents_CommandBarsUpdate(ByVal sender As Object, ByVal e As System.EventArgs) Handles adxOutlookEvents.CommandBarsUpdate
If Not PrintPage1ExplorerToolbar.Visible = LastChangedVisibility Then
'If execution cames here then the toolbar visibility has just been changed - probably by the user clicking View - Toolbars
LastChangedVisibility = PrintPage1ExplorerToolbar.Visible
My.Settings.ShowExplorerToolbar = LastChangedVisibility
My.Settings.Save()
End If
End Sub
And set the visibility in the AddinStartupComplete event
Me.PrintPage1ExplorerToolbar.Visible = My.Settings.ShowExplorerToolbar |
|
Andrei Smolin
Add-in Express team
Posts: 19138
Joined: 2006-05-11
|
You are welcome, Mike!
Andrei Smolin
Add-in Express Team Leader |
|