Edit

Share via


IRibbonUI.InvalidateControl(String) Method

Definition

Invalidates the cached value for a single control on the Ribbon user interface.

public:
 void InvalidateControl(System::String ^ ControlID);
public void InvalidateControl (string ControlID);
abstract member InvalidateControl : string -> unit
Public Sub InvalidateControl (ControlID As String)

Parameters

ControlID
String

Specifies the ID of the control that will be invalidated.

Examples

In the following example, starting the host application triggers the onLoad event procedure that then calls a procedure which creates an object representing the Ribbon UI. Next, a callback procedure is defined that invalidates a control on the UI and then refreshes the UI.

The following is the XML markup for Office to load the custom ribbon:

<customUI … onLoad=”MyAddInInitialize” …>

The following is the callback method for the onLoad event:

Dim MyRibbon As IRibbonUI
Sub MyAddInInitialize(Ribbon As IRibbonUI)
    Set MyRibbon = Ribbon
End Sub

Sub myFunction()
    ‘ Invalidates the cache of a single control 
    MyRibbon.InvalidateControl(“control5”)            
End Sub

Remarks

You can customize the Ribbon UI by using callback procedures in COM add-ins. For each of the callbacks the add-in implements, the responses are cached. For example, if an add-in writer implements the getImage callback procedure for a button, the function is called once, the image loads, and then if the image needs to be updated, the cached image is used instead of recalling the procedure. This process remains in-place for the control until the add-in signals that the cached values are invalid by using the InvalidateControl method, at which time, the callback procedure is again called and the return response is cached.

Applies to