Instantiating the TaskPanes

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

Instantiating the TaskPanes
Kirill Lapin

Posts: 42
Joined: 2011-05-04
Hello Andrei,

Now that I had some time to review and try the code you kindly provided, I think it solves one part of my issue, which is the adxTaskPane own instance and Excel window awareness and that is very handy. However, I fail to see how the use of the BaseLogic helps me manipulate directly controls from one pane on another. What I am trying to achieve is something like the following:
Public Class ADXExcelTaskPane1
Private Sub PaneButtonClicked(sender As Object, e As PaneButtonClickEventArgs)
    ADXExcelTaskPane2.Label5.Text = e.PaneName + " in '" + e.ExcelWindow.Caption + "'"
End Sub
End Class

and it seems that I still need to go via:
Dim TaskPane2 As ADXExcelTaskPane2 = AddinModule.CurrentInstance.AdxExcelTaskPanesCollectionItem2.TaskPaneInstance 

or am I missing something?

Thank you,
Posted 23 Jan, 2019 06:38:39 Top
Andrei Smolin

Add-in Express team

Posts: 17184
Joined: 2006-05-11
Hello Kirill,

BaseLogic introduces an indirection layer. You should use it to modify something on another pane.

Consider introducing types of panes. For instance, you could have panes typed as TypeSomeData, TypeSomeOtherData, etc. This is a custom type, not the class type; the class types are ADXExcelTaskPane1 and ADXExcelTaskPane2.

Whenever pane instances registers with the BaseLogic class, they provide their types. When you call e.g. UpdateSomeDataPane(<some info>), the BaseLogic class checks the panes registered, finds out the pane of the TypeSomeData type and calls thePaneInstance.SomeMethod() on it. In this way, pane1 doesn't need to manage an instance of pane2.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 23 Jan, 2019 08:56:58 Top