Make Ribbon Document Context Sensitive

  • Thread starter Patrick Schmid [MVP]
  • Start date
M

Michael Tissington

I have an addin for Word that modifies the Ribbon if the document opened is
a template.

How do I make it document context sensitive ?

What I mean by this is

1) User open Word and starts creating a normal document (Ribbon should be
standard)
2) Users opens a template (Ribbon should show my changes)
3) User switches back to original document (Ribbon should be standard)
4) etc

Any ideas please ?
 
M

Michael Tissington

I'm not using a template, the user can create templates - I should be able
to do this using events shouldn't I and seeing when the user changes the
active document.

So I guess my question is how do I see when the user changes whcih the
active document is.


Patrick Schmid said:
Add the RibbonX to the template?

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007: http://pschmid.net/office2007/customize
RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed

I have an addin for Word that modifies the Ribbon if the document opened
is
a template.

How do I make it document context sensitive ?

What I mean by this is

1) User open Word and starts creating a normal document (Ribbon should be
standard)
2) Users opens a template (Ribbon should show my changes)
3) User switches back to original document (Ribbon should be standard)
4) etc

Any ideas please ?
 
P

Patrick Schmid [MVP]

In theory, yes. The RibbonX part of it, you'd have to do with getVisible
and getEnabled callbacks (you need both. Invisible elements can still be
added to the QAT and hence you need to disable all of your controls
individually). You'd probably have to use the Win32 API to get notified
when the handle for the active window changes and then figure out if
that's a Word window. If that is, then you can figure out what is
displayed in it.
However, you have to keep in mind that a user could have two Word
windows open next to each other, and that both would display the Ribbon
identically. So if once contains a template and one doesn't and the
template one is active, then the user will see both windows with the
template stuff showing. If the user clicks the other window, both
windows change. In my opinion, you are going to drive your users nuts
with this. I wouldn't do it.
Can you elaborate on your scenario as to why you want to do this? Maybe
there is a better way to handle this.

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007: http://pschmid.net/office2007/customize
RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed

I'm not using a template, the user can create templates - I should be able
to do this using events shouldn't I and seeing when the user changes the
active document.

So I guess my question is how do I see when the user changes whcih the
active document is.


Patrick Schmid said:
Add the RibbonX to the template?

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007: http://pschmid.net/office2007/customize
RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed

I have an addin for Word that modifies the Ribbon if the document opened
is
a template.

How do I make it document context sensitive ?

What I mean by this is

1) User open Word and starts creating a normal document (Ribbon should be
standard)
2) Users opens a template (Ribbon should show my changes)
3) User switches back to original document (Ribbon should be standard)
4) etc

Any ideas please ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top