IXMLSpyPlugIn.OnUpdateCommand
See also
Declaration: OnUpdateCommand(nID as long, pXMLSpy as IDispatch) as SPYUpdateAction
Description
The OnUpdateCommand() method is called each time the visible state of a button or menu item needs to be set. nID stores the command ID defined by the ID element of the respective UIElement.
pXMLSpy holds a reference to the dispatch interface of the Application object.
Possible return values to set the update state are:
spyEnable | = 1 |
spyDisable | = 2 |
spyCheck | = 4 |
spyUncheck | = 8 |
Example
Public Function IXMLSpyPlugIn_OnUpdateCommand(ByVal nID As Long, ByVal pXMLSpy As Object) As SPYUpdateAction
IXMLSpyPlugIn_OnUpdateCommand = spyDisable
If (Not (pXMLSpy Is Nothing)) Then
Dim objSpy As XMLSpyLib.Application
Set objSpy = pXMLSpy
If nID = 3 Or nID = 5 Then
IXMLSpyPlugIn_OnUpdateCommand = spyEnable
End If
If nID = 4 Or nID = 6 Then
If objSpy.Documents.Count > 0 Then
IXMLSpyPlugIn_OnUpdateCommand = spyEnable
Else
IXMLSpyPlugIn_OnUpdateCommand = spyDisable
End If
End If
End If
End Function