1
votes

I'm creating a word addin with a custom pane.

I'm also creating a Ribbon with a checkbox control which shows/hides the custom pane based on the checked change event.

All works well if I have only one instance of word.

When I create another instance of word document, clicking the checkbox in document 2 triggers event for document 1 and hides the pane.

How to sync the ribbon and custom pane separately for each instance of word ?

Thanks.

1

1 Answers

3
votes

With Word it's important to note that a new document window is usually NOT equivalent to a new instance of the Word application. Word is pseudo-SDI, meaning it opens a separate window for each document, rather than multiple documents sharing the same application window. But there's only the one application instance.

What you describe is an issue with any pseudo-SDI application: the Ribbon and Custom Task Panes display and keep state for the window in which they were created. In order to have them "track" individual windows, you need code that tracks which document window currently has the focus and change states accordingly. See for example the discussion here: http://msdn.developer-works.com/article/11561210/SDI+app+challenge+(custom+task+panes)

And the section "Managing Custom Task Panes in Multiple Application Windows" in this article: https://msdn.microsoft.com/en-us/library/aa942864.aspx#WordAndInfoPath

They both describe how you have to use events in order to track the state of controls per document/window.