Enabling methods (in menus and keys)

Build 1501 on 14/Nov/2017  This topic last edited on: 21/Mar/2016, at 18:34

To define if a method has to be enabled in the menu /available as a keyboard shortcut in a given context, <ShellCommand(CanExecute prefix is used before the method name:

 <ShellCommand(CanExecute:="<enablerfunction")> _

Public Sub subname()

...

where "enablerfunction" is a custom code that returns True if the context is appropriate. An example that checks if the context is text editing:

 <ShellCommand(CanExecute:="Ena_TxtEdit")> _

Public Sub MouseWheel()

...

The custom function in the above example is:

Public Function Ena_TxtEdit() As Boolean

  Return Text IsNot Nothing

End Function

See also

Tick marks in menus