Commandbars and ReadingView

P

Peter Karlström

Hi

I have developed a COM-Addin for Word in which a commandbar is created.

Everything works fine but now I have detected a problem.

If I open a document which is attached to a mail, Word opens the document in
ReadingView-mode. In that view my commanbar is created and alright.
But when I click Close to get to ordinary view of the document, the commandbar
is disabled.
No event is triggered (as far as I can see) when the close-button is used.
It's still in the list of toolbars but the user has to re-enable it.

Is there a workaround, or have I missed something?

Thanks in advance

Regards
 
C

Cindy M.

Hi =?Utf-8?B?UGV0ZXIgS2FybHN0csO2bQ==?=,
I have developed a COM-Addin for Word in which a commandbar is created.

Everything works fine but now I have detected a problem.

If I open a document which is attached to a mail, Word opens the document in
ReadingView-mode. In that view my commanbar is created and alright.
But when I click Close to get to ordinary view of the document, the commandbar
is disabled.
No event is triggered (as far as I can see) when the close-button is used.
It's still in the list of toolbars but the user has to re-enable it.
Is it disabled, or is it just closed (.Visible = False)? Those are two very
different things, and I don't know how a user would re-enable a disabled
commandbar. OTOH, Word making it not visible is expected behavior.

Apparently, no events are fired when this ReadingMode is changed. I have tracked
down which commands Word uses for its toolbar buttons. If you were working with
VBA, then you could intercept the commands using procedures with the command
names, like this:

Sub ReadingMode()
Dim ToggleLayout As Boolean
ToggleLayout = ActiveDocument.ActiveWindow.View.ReadingLayout
ActiveDocument.ActiveWindow.View.ReadingLayout = Not ToggleLayout
CommandBars("My toolbar").Visible = True
End Sub

Sub CloseReadingMode()
Dim ToggleLayout As Boolean
ToggleLayout = ActiveDocument.ActiveWindow.View.ReadingLayout
ActiveDocument.ActiveWindow.View.ReadingLayout = Not ToggleLayout
CommandBars("My toolbar").Visible = True
End Sub

This won't work for a COM Add-in. However, you could create your own buttons
- that look just like Word's built-in ones, substitute them for Word's on the
Standard and Reading Layout commandbars, and have them do something similar to
the above.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
P

Peter Karlström

Hi Cindy

Thanks for your quick reply and your recommended approach.

I suspected a lack of event for this and have tried every possible setting
for the toolbar itself to keep it in place. But with no luck.

As for your question; If I right-click the toolbar area the customized
tollbar is shown in the list, but not "as a toolbar". If I click it in the
list it reappears as it should.

Your solution for a COM-addin is much appreciated. Then I have a solution if
the customer starts complaining about this behaviour.

Once again, Thanks.

Regards
 

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