Siddharth Rout
Posts: 18
Joined: 2020-03-26
|
Hi
I have 2 queries.
1. I want the taskpane to be hidden when the Add-in starts
2. I want to show the task pane when a button in the ribbon is pressed.
For my first query, I went through the post https://www.add-in-express.com/forum/read.php?FID=5&TID=3288 but I noticed that for it to work, I have to add both the codes and not just one of them.
Public Class AddinModule
'
'
'
Private HideByDefault As Boolean = True
Private Sub AdxExcelTaskPanesManager1_ADXBeforeTaskPaneInstanceCreate(sender As Object,
e As ADXBeforeTaskPaneInstanceCreateEventArgs) Handles AdxExcelTaskPanesManager1.ADXBeforeTaskPaneInstanceCreate
If (HideByDefault) Then
e.Cancel = True
HideByDefault = False
End If
End Sub
End Class
and
Public Class tskPaneActivity
'
'
'
Private HideByDefault As Boolean = True
Private Sub tskPaneActivity_ADXBeforeTaskPaneShow(sender As Object,
e As ADXBeforeTaskPaneShowEventArgs) Handles Me.ADXBeforeTaskPaneShow
If HideByDefault Then
Me.Visible = False
HideByDefault = False
End If
End Sub
End Class
If I use only one of them then it does not work. i.e the task pane remains visible.
Appreciate any help with both my queries.
SidRegards
Siddharth Rout
Founder
XPIZON
[Skype]: XPIZON, [Email]: srout@xpizon.com, [Website]: www.SiddharthRout.Com; www.xpizon.com
|
|
Andrei Smolin
Add-in Express team
Posts: 18829
Joined: 2006-05-11
|
|
Siddharth Rout
Posts: 18
Joined: 2020-03-26
|
Thanks Andrei. I am facing the same problem with this code as well.
In my Add-in Module
Public Const showPanesAtStartup As Boolean = True
Private Sub AdxRibbonButton1_OnClick(sender As Object, control As IRibbonControl, pressed As Boolean) Handles AdxRibbonButton1.OnClick
Dim context As Object = control.Context
Dim pane As Logging.ILogPane = GetPane(Me.HostType, context)
If pane IsNot Nothing Then pane.Show()
If context IsNot Nothing Then Marshal.ReleaseComObject(context)
End Sub
Private Function GetPane(ByVal host As AddinExpress.MSO.ADXOfficeHostApp, ByVal contextWindow As Object) As Logging.ILogPane
If contextWindow Is Nothing Then Return Nothing
Dim pane As Logging.ILogPane = Nothing
pane = TryCast(AdxExcelTaskPanesCollectionItem1.TaskPaneInstance, Logging.ILogPane)
Return pane
End Function
In my ADXExcelTaskPane1
Private letMeShow As Boolean = False
Private Sub ADXExcelTaskPane1_ADXBeforeTaskPaneShow(ByVal sender As System.Object,
ByVal e As AddinExpress.XL.ADXBeforeTaskPaneShowEventArgs) Handles MyBase.ADXBeforeTaskPaneShow
Me.Visible = letMeShow
End Sub
I have also imported imported Logging.ILogPane
When Excel starts, the panel is hidden as expected because of "Me.Visible = letMeShow" but then "pane = TryCast(AdxExcelTaskPanesCollectionItem1.TaskPaneInstance, Logging.ILogPane)" is returning "Nothing".
Am I missing something here?Regards
Siddharth Rout
Founder
XPIZON
[Skype]: XPIZON, [Email]: srout@xpizon.com, [Website]: www.SiddharthRout.Com; www.xpizon.com
|
|
Siddharth Rout
Posts: 18
Joined: 2020-03-26
|
Thanks Andrie.. I managed it. Much appreciated.Regards
Siddharth Rout
Founder
XPIZON
[Skype]: XPIZON, [Email]: srout@xpizon.com, [Website]: www.SiddharthRout.Com; www.xpizon.com
|
|
Andrei Smolin
Add-in Express team
Posts: 18829
Joined: 2006-05-11
|
Great!
Andrei Smolin
Add-in Express Team Leader |
|