Commands (ActiveX Control)

Whenever a menu option is selected in a SIS application, a command is invoked. Each of these commands has a name, which users normally are unaware of. The Developers Control Bar displays these commands as they are selected, enabling ActiveX programmers to find the name and use it when writing applications. All system command names begin with the letters "ACom".

Note:ACom is case sensitive and must be in this form. If any other combination of upper and lower case letters are used, for example "acom", then SIS will not recognise the command.

Click here to see a full list of ACom commands available in SIS.

Adding Custom Commands

ActiveX Control applications only have access to the local, right-mouse menu because no main menu exists. Local commands are added using AddCommand.

Sis.AddCommand "View Area Details", "Display Area item details", "Area", 1, 1, "", ""

Whenever a single Polygon item is selected, the local, right-mouse menu will contain the "View Area Details" command. When this command is selected by the user the AppCommand SIS Control Event will be called with the menu string (the first argument to AddCommand as the comname$ argument. The application can then respond to this event, in this case by displaying a dialog containing information about the selected Polygon item.

Note: 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.

Running System Commands

Although the SIS API contains many functions to perform operations in the ActiveX Control, it is sometimes easier to invoke one of the system commands than to write application code to produce the same result. Any of the commands available to the user may also be invoked, although some are obviously more useful than others.

System commands fall into two categories: One-shot commands (those which perform an action without user mouse or positional input, e.g. Redraw [Home-Map]); and Callback commands (those which require user mouse or positional input,

e.g. LineString [Create-Simple].

In the SIS Control, both one-shot and callback commands are run using the DoCommand method.

'Redraw the view by command.
Sis.DoCommand "AComRedraw"

'Start drawing a line.
Sis.DoCommand "AComLineEx"

The one-shot redraw command will be started and completed in the duration of the DoCommand method. The callback command however exists beyond the duration of the call to the DoCommand method, in this case until the user presses Enter or Ctrl-Enter to complete the line, or Escape to quit the command. The progress of callback commands is monitored using Events.

Note: The DoCommand method can be called with either a one-shot, or a callback command, and will choose the appropriate action.


Top of page

Send comments on this topic.

Click to return to www.cadcorp.com

© Copyright 2000-2017 Computer Aided Development Corporation Limited (Cadcorp).