AddCommand Method
Description
Adds an application-defined command to the menu, with restrictions on use. SIS Control applications can only add to the local menus.
Syntax
Visual Basic |
---|
Public Function AddCommand( _ ByVal menu As String, _ ByVal help As String, _ ByVal clsName As String, _ ByVal min As Integer, _ ByVal max As Integer, _ ByVal filter As String, _ ByVal locus As String _ ) As Integer |
Parameters
- menu
-
The menu command string. Applications which use the SIS Control will have the AppCommand event called with this string as an argument. GisLink customisations must have a button on the main form with this string as the Caption.
In order to add to an existing menu, this string must exactly match the menu text (including ampersand (&) characters preceding any underlined keyboard shortcut, and pipe (|) characters to signify a sub-menu).
If this string does not include a pipe symbol then the command will be added to the local, right-mouse menu. Sub-menus on the local menu are denoted by the hash (#) symbol. Keyboard shortcuts are not supported on the local menu.
- help
- the prompt to be displayed when the command is highlighted.
- clsName
- the class or group name this command is to be associated with. If set to "Item" or "" then the command will be available for all Item classes.
- min
- the minimum number of Items which must be selected to make this command valid. If min is set to -1 then Hittable and Editable Items are valid. If min is set to 0 then no Items have to be selected. If min is set to 1 then only Editable Items are valid.
- max
- The maximum number of Items which may be selected to enable this command. If max is -1 then there is no limit. If both min and max are set to 0 and the command is a local command, then the command will only appear on the local menu when no Items are selected.
- filter
- optionally specifies a named Filter which all selected Items must pass for the command to be available.
- locus
- optionally specifies a named Spatial Filter which all selected Items must pass for the command to be available.
Remarks
Available: D OD OM OV SISpy
Groups:
Example
sis.AddCommand ("Display Property Details",
"Displays the details of the current Selected Property", "Point", 1, 1, "Properties", "Spatial Search" )
The local menu Display Property Details will be available whenever a single point item which matches the filter Properties but is also within the Spatial Filter Spatial Search, is selected.
Functions that create Buttons and Menu items have the option for a filter. These filters can be set for a class of Item, i.e. LineString, Polygon, etc.
The following sample code shows this where the class is for a Group:
Sis1.CreatePropertyFilter("GroupItem", "_classLocal$ = ""Group""") Sis1.AddCommand("Display Group Details","Displays the details of the current Selected Group", "Item", 1, 1, "GroupItem", "")
By design the class filter for a Group will not work for the AddCommand, Buttons or Menus.
Note: See also Commands (ActiveX Control).