Gary Garside
Posts: 15
Joined: 2012-10-19
|
Hi all,
We have created an addon that includes an Explorer Bar and a Toolbar. The Toolbar has 2 buttons on it: "Hide Toolbar" and "Toggle Sidebar". We also have 2 ADXIE Menu Items which have to be updated once the aforementioned buttons have been clicked so as to keep the state across the app.
Toggle Sidebar seems to behave extremely inconsistently across operating systems and browsers. Here's the code I'm using in my Toolbar class on the "Toggle Sidebar" click handler:
' Get the IEModule
Dim m As IEModule = Me.Module.GetModuleByTabIndex(CurrentTab)
' Get the Sidebar
Dim SidebarObj As AddinExpress.IE.ADXIEBar = m.Bars.Item(0).BarObj
Dim Visible = True
If Not SidebarObj Is Nothing Then
Visible = Not SidebarObj.Visible
End If
' Toggle the Sidebar
Dim dummy As Object = Nothing
Dim show As Object = Visible
Dim guid As Object = Type.GetType("OurAppName.Sidebar").GUID.ToString("B")
IEApp.ShowBrowserBar(guid, show, dummy)
' Toggle our Menu Item
Dim MenuItem As AddinExpress.IE.ADXIEMenuItem = m.AdxieMenuItem2
MenuItem.Checked = Visible
Can anyone see any reason why the above code wouldn't work? And more importantly, does anyone know a way to bind the "Toggle Sidebar" button to the Explorer Bar itself, much like the automatically added command bar button?
Thanks in advance,
Gary |
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Hi Gary,
I would change the code as shown below:
Dim m As IEModule = Me.Module
Dim m As IEModule = Me.Module
' Get the Sidebar
Dim SidebarObj As AddinExpress.IE.ADXIEBar = m.Bars.Item(0).BarObj
Dim Visible = False
If Not SidebarObj Is Nothing Then
Visible = SidebarObj.Visible
End If
' Toggle the Sidebar
Dim dummy As Object = Nothing
Dim show As Object = Not Visible
Dim guid As Object = GetType(MyIEBar1).GUID.ToString("B")
IEApp.ShowBrowserBar(guid, show, dummy)
...............
The code may not work if the add-on (BHO) is not started. In this case you need to check if the OnConnect event fires in your module (BHO). |
|
Gary Garside
Posts: 15
Joined: 2012-10-19
|
Hi Sergey,
Thanks for the quick response. I'll give your code a try and let you know.
Gary |
|
Gary Garside
Posts: 15
Joined: 2012-10-19
|
Just the ticket, Sergey. Many thanks!
Gary |
|