Altova XMLSpy 2024 Enterprise Edition

See also


Declaration: OnUpdateCommand(nID as long, pXMLSpy as IDispatch) as SPYUpdateAction



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




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


               IXMLSpyPlugIn_OnUpdateCommand = spyDisable

          End If

      End If

  End If

End Function

© 2018-2024 Altova GmbH