Programmatically display a previously-disabled task pane in Word 2007

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

Programmatically display a previously-disabled task pane in Word 2007
 
Patrick Linskey




Posts: 5
Joined: 2010-03-24
Hi,

I'm building an add-in that has a few task panes that are initially not displayed. I want to show the task panes after a ribbon button is clicked.

My code currently does the following:

bottomTaskPaneItem.Enabled = true;


This does not reliably work. After clicking on my button, the task pane is not displayed. However, if I subsequently switch to full-screen view or open another Word document, the task pane displays at that time.

Also, if I've attached a debugger to the process, and I set a breakpoint just before that line, and then simply hit 'run' after triggering the breakpoint, the task pane does reliably re-appear.

I've tried using ShowTaskPane(), to no avail -- it has no impact, regardless of whether or not I set a breakpoint.

Is there anything else I should try to get the task pane item to reliably load?

Note that hiding the item by setting Enabled to false works beautifully.

Thanks,

-Patrick
Posted 04 Sep, 2010 12:36:57 Top
Eugene Astafiev


Guest


Hi Patrick,

Please try using the Visible property instead. Also please have a look at the http://www.add-in-express.com/support/addin-c-sharp.php page. It contains the How to develop your first COM add-in for Microsoft Office in C# sample add-in project. You can find all the required steps in the mentioned sample project.
Posted 06 Sep, 2010 09:51:41 Top
Patrick Linskey




Posts: 5
Joined: 2010-03-24
Hi,

Thanks for the response.

As far as I can tell, AddinExpress.WD.ADXWordTaskPanesCollectionItem does not have a property called 'Visible'. The code in the sample that you pointed me at was using an object of type AddinExpress.MSO.ADXTaskPane, which is different than what I'm working with in a couple ways.

In particular, at the point in code at which I'm currently initializing things, I only have access to an ADXWordTaskPanesCollectionItem -- at this point in the initialization lifecycle, presumably no Word windows have been created, and thus the CollectionItem's TaskPaneInstances data structure is empty. Now, I expect that I could easily defer my initialization to a little later -- I'll try that out.

Note, however, that I based my current approach on the product documentation. It might be worthwhile to update them to at least discuss the lifecycle timing issues surrounding the use of the Enabled and ShowTaskPane() APIs.

Thanks,

-Patrick
Posted 07 Sep, 2010 20:51:19 Top
Patrick Linskey




Posts: 5
Joined: 2010-03-24
Hi,

I've figured out a workaround that seems to get things working. It's ugly, but here goes:

Courier

-Patrick
Posted 07 Sep, 2010 22:19:00 Top
Eugene Astafiev


Guest


Posted 08 Sep, 2010 04:24:19 Top