Adding and Running Commands

When you select a menu option in Cadcorp SIS Desktop application, a command is invoked.

Each command has a name.

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. SIS Desktop will not recognise commands if any other combination of upper and lower case letters are used (eg "acom").

Add 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.

Selecting this command calls the AppCommand SIS Control Event 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.

Run System Commands

Although the Cadcorp SIS Desktop API contains many functions to perform operations in the ActiveX Control, it can sometimes be easier to invoke system commands than to write application code.

Any of the commands available to the user may also be invoked.

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 (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.