Interacting with the Map

User Position Input (ActiveX Control)

ActiveX Control applications often require using the mouse to input positions.

This forms part of a set of a procedural actions (e.g. prompt the user for text, get a position from the user and then create a Text item using the results).

However this procedural paradigm conflicts with the Windows Graphical User Interface (GUI) model of dialog input (where users can interact with many controls in any order before pressing the OK or Apply button.)

As a result the ActiveX Control uses Events to tell the application when the user has interacted with it.

In order to mimic a procedural approach, the procedure is split into two parts:

  1. Before a position or positions are required and
  2. After the required position(s) have been supplied.

The first part may be started by a button press on the application dialog and will prompt the user for text. After the text is successfully entered, the application will set a flag to indicate a position was being requested.

This flag will be checked in the Snap event. If the flag is set the second part of the procedural command is carried out (e.g. create a Text item using the previously entered text before resetting the flag).

This approach does however have drawbacks:

global flags are required to monitor the application state which other user actions can affect and global variables are required, e.g. to remember the text.

You can ameliorate these drawbacks by:

  • Eliminating a global variable by getting the position first then prompting the user;
  • Showing another dialog to collect the details; or
  • Disabling the rest of the dialog until a position is entered.

However the dichotomy between the procedural- and event-based paradigms remains.


GisLink which has the advantage of using SIS Desktop as an application, as opposed to the ActiveX Control that exists within a foreign environment has the GetPos and GetPosEx methods to overcome the procedural versus event problem.

The same techniques can be used with the ActiveX Control using Visual Basic and Visual C++ but are unsupported because other OLE Container applications may not have an equivalent or their effects may be platform-dependent.

Both the Visual Basic and Visual C++ code fragments shown may be used to get more than one position from the user as outlined in User Position Input above.