Daniel McPherson
Posts: 15
Joined: 2005-03-23
|
Hi Again folks, (I'm getting the hang of this, I really am...)
(by the way, support for this product is fantastic!)
I have a commandbar that I want to clear of all buttons, however the clear method doesn't seem to be working. It stops the button responding to events however it is still visible on the commandbar and I want it deleted. Please find below a very basic sample app demonstrating the problem:
Imports System.Runtime.InteropServices
Imports System.ComponentModel
'Add-in Express Add-in Module
<GuidAttribute("C050639D-EE68-40BB-A667-D2D2E4EEE0DF"), ProgIdAttribute("testcb.AddinModule"), RunInstaller(True)> _
Public Class AddinModule
Inherits AddinExpress.MSO.ADXAddinModule
Friend WithEvents AdxOlExplorerCommandBar1 As AddinExpress.MSO.ADXOlExplorerCommandBar
Friend WithEvents AdxOlInspectorCommandBar1 As AddinExpress.MSO.ADXOlInspectorCommandBar
#Region " Component Designer generated code. "
'Required by designer
Private components As System.ComponentModel.IContainer
'Required by designer - do not modify
'the following method
Friend WithEvents Inspector As AddinExpress.MSO.ADXCommandBarButton
Friend WithEvents Explorer As AddinExpress.MSO.ADXCommandBarButton
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Me.AdxOlExplorerCommandBar1 = New AddinExpress.MSO.ADXOlExplorerCommandBar(Me.components)
Me.Explorer = New AddinExpress.MSO.ADXCommandBarButton(Me.components)
Me.AdxOlInspectorCommandBar1 = New AddinExpress.MSO.ADXOlInspectorCommandBar(Me.components)
Me.Inspector = New AddinExpress.MSO.ADXCommandBarButton(Me.components)
'
'AdxOlExplorerCommandBar1
'
Me.AdxOlExplorerCommandBar1.CommandBarName = "AdxOlExplorerCommandBar1"
Me.AdxOlExplorerCommandBar1.CommandBarTag = "301f180c-c561-4437-bb78-b3ffa36bca74"
Me.AdxOlExplorerCommandBar1.Controls.Add(Me.Explorer)
Me.AdxOlExplorerCommandBar1.Temporary = True
Me.AdxOlExplorerCommandBar1.UpdateCounter = 3
'
'Explorer
'
Me.Explorer.Caption = "Explorer (Clear)"
Me.Explorer.ControlTag = "5887055f-5997-449d-8c98-2d3389f01f36"
Me.Explorer.ImageTransparentColor = System.Drawing.Color.Transparent
Me.Explorer.Temporary = True
Me.Explorer.UpdateCounter = 4
'
'AdxOlInspectorCommandBar1
'
Me.AdxOlInspectorCommandBar1.CommandBarName = "AdxOlInspectorCommandBar1"
Me.AdxOlInspectorCommandBar1.CommandBarTag = "92364702-8f3e-40d2-84d9-1bfa1a747166"
Me.AdxOlInspectorCommandBar1.Controls.Add(Me.Inspector)
Me.AdxOlInspectorCommandBar1.Temporary = True
Me.AdxOlInspectorCommandBar1.UpdateCounter = 3
'
'Inspector
'
Me.Inspector.Caption = "Test"
Me.Inspector.ControlTag = "4460e65a-7342-4a57-8ad1-0ee66b054f26"
Me.Inspector.ImageTransparentColor = System.Drawing.Color.Transparent
Me.Inspector.Temporary = True
Me.Inspector.UpdateCounter = 3
'
'AddinModule
'
Me.AddinName = "testcb"
Me.SupportedApps = AddinExpress.MSO.ADXOfficeHostApp.ohaOutlook
End Sub
#End Region
#Region " ADX automatic code "
'Required by Add-in Express - do not modify
'the methods within this region
Public Overrides Function GetContainer() As System.ComponentModel.IContainer
GetContainer = components
End Function
<ComRegisterFunctionAttribute()> _
Public Shared Sub AddinRegister(ByVal t As Type)
AddinExpress.MSO.ADXAddinModule.ADXRegister(t)
End Sub
<ComUnregisterFunctionAttribute()> _
Public Shared Sub AddinUnregister(ByVal t As Type)
AddinExpress.MSO.ADXAddinModule.ADXUnregister(t)
End Sub
Public Overrides Sub UninstallControls()
MyBase.UninstallControls()
End Sub
#End Region
'Add-in Module Implementation
Public Sub New()
MyBase.New()
'This call is required by the Component Designer
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
Private Sub Explorer_Click(ByVal sender As Object) Handles Explorer.Click
Me.AdxOlInspectorCommandBar1.Controls.Clear()
End Sub
Private Sub Inspector_Click(ByVal sender As Object) Handles Inspector.Click
MsgBox("hit")
End Sub
End Class
|
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Hi Daniel.
We don't recommend to clear collections of controls at runtime.
Now ADX doesn't support this feature. If you want to remove some buttons from a host application at runtime you can use the Customize dialog. |
|
Daniel McPherson
Posts: 15
Joined: 2005-03-23
|
OK, how about removing buttons? I bascially want to change the buttons that are listed on a commandbar.
Any advice appreciated.
Daniel |
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
You can delete buttons at disign-time in your addinmodule and rebuild the project. Then run Outlook. ADX will remove buttons from a commandbar. |
|
Daniel McPherson
Posts: 15
Joined: 2005-03-23
|
I undertsand, but I need to be able to do it at runtime. |
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
I think the best way is, to manage visibility of buttons using the Visible property of ADX controls. |
|
Daniel McPherson
Posts: 15
Joined: 2005-03-23
|
OK, thanks, will look to do that. |
|