How to hide and show ToolBar using Button or Event?

Add-in Express™ Support Service
That's what is more important than anything else

How to hide and show ToolBar using Button or Event?
 
Vadim Usmanov




Posts: 18
Joined: 2012-03-23
Hi!
My question is: how to hide and show ToolBar using Button or Event?

I can hide ToolBar using Button_Click but only if the code inside the ToolBar-module (MyIEToolBar1):

    Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
           Me.Visible = False 
    End Sub


How can I call a procedure hide/show ToolBar from another module or for instance from IEModule_BeforeNavigate2 Event?

I have not found a way.

Thanks in advance.
Posted 23 Mar, 2012 14:46:20 Top
Vadim Usmanov




Posts: 18
Joined: 2012-03-23
The problem is solved.

I took example from http://www.add-in-express.com/forum/read.php?PAGEN_1=2&FID=5&TID=5173#nav_start

and use the Module property of my toolbar to get the corresponding IE module.

This is my code (may be useful to someone):

Private Sub AdxieContextMenu1_OnClick(sender As System.Object, htmlElement As System.Object) Handles AdxieContextMenu1.OnClick
        '24.03.12 Hide/show ToolBar from IEModule
        Dim ToolbarObject As MyIEToolbar1 = CType(Me.AdxieToolBarItem1.ToolBarObj, MyIEToolbar1)

        If ToolbarObject.Visible = True Then
            ToolbarObject.Visible = False
        Else
            ToolbarObject.Visible = True
        End If
    End Sub
Posted 24 Mar, 2012 06:16:25 Top
Andrei Smolin


Add-in Express team


Posts: 17178
Joined: 2006-05-11
Hello Vadim,

Thank you for posting the code. Here's what we included into the manual:

Calling a method defined in an ADXIEToolbar from the IE Module
'VB.NET
Dim toolbarItem As AddinExpress.IE.ADXIEToolBarItem = Me. ToolBars(0)
Dim toolbarObj As AddinExpress.IE.ADXIEToolbar = toolbarItem. ToolBarObj
Dim myToolbar As MyIEAddon1.MyIEToolBar1 = _
    CType(toolbarObj, MyIEAddon1.MyIEToolBar1)
myToolbar.MyMethod()


//C#
AddinExpress.IE.ADXIEToolBarItem toolbarItem = this.ToolBars[0];
AddinExpress.IE.ADXIEToolbar toolbarObj = toolbarItem.ToolBarObj;
MyIEAddon1.MyIEToolBar1 myToolbar = toolbarObj as MyIEAddon1.MyIEToolBar1;
myToolbar.MyMethod();


Hope this helps.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 26 Mar, 2012 02:54:25 Top