Get Ribbon control

N

NickP

Hi there,

I would like to grab a reference to a Ribbon toggle button that I have
created and change it's toggle status. How would I achieve this? I can't
find any reference to the toggle status via IRibbonControl nor can I see a
way of getting this reference in the first instance.

Many thanks in advance!

Nick.
 
N

NickP

I found the correct way to do this.

First make a callback to get the toggle state...

Public Function OnButtonGetPressed(ByVal control As Office.IRibbonControl)
As Boolean
Return (<togglestate>)
End Function

..... xml ribbon code as follows

<toggleButton ... getPressed="OnButtonGetPressed" ... />

.....

Next make a refresh method in your ribbon class...

Public Sub Refresh()
Call ribbon.InvalidateControl("id of button here")
End Sub

Then call the refresh method when the visibility of your custom panel
changes. Simple as that, although I'm not sure if it supports multiple
document windows as yet.

Nick.
 

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