Altova XMLSpy 2024 Enterprise Edition

声明

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

 

描述

每次需要设置按钮或菜单项的可见状态时都会调用OnUpdateCommand()方法。nID存储由相应的UIElementID元素定义的命令ID。pXMLSpy持有对Application对象的调度接口的引用。

 

设置更新状态的可能返回值有:

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

        Else

           IXMLSpyPlugIn_OnUpdateCommand = spyDisable

        End If

     End If

  End If

End Function

 

© 2017-2023 Altova GmbH