Friday, September 09, 2005

Applications Interacting with GTViewer

We get questions about how an application written in, say Visual Basic, can interact with GTViewer. This capability has been in GTViewer for a long time. We have recently updated the documentation in gtvconfig.doc for the 5.0 release, and it includes a descrioption of just how to do it. I'm going to paste a preview of that section of gtvconfig.doc below. It will be most useful when used on conjunction with gtvx.doc, which has a decription near the front about the differences between using GTVx and the methods exposed by GTViewer, as well as a list of methods and which ones are currently exposed in GTViewer.

So here is a section you put in the .gtm file in order to let your VB app interact with GTViewer. It will appear on the Query menu with a name you specify:

External Applications Section

The External Applications Section is used to specify parameters for ActiveX user controls. This mechanism allows sophisticated applications to be developed in Visual Basic that call methods exposed by GTViewer and interact with the graphics and tabular data.

· The ActiveX entry defines an external application for GTViewer with the following format:

ActiveX|<name>|<menu Position>|<objectPath>|<mode>
|<flags>|<height>|<width>|<x>|<y>|


  • Name is the name that will appear on the Query menu in GTViewer at the bottom of the list after the names of locate and thematic highlight queries. The Name must be unique.
  • Menu Position is for future use. Currently, it should be set to the numeral “1”.
  • ObjectPath is the path to the ActiveX user control that the system will recognize. In Visual Basic projects, the objectPath will typically be the name of the Project as found in Project > Properties followed by a dot, followed by the name of the user control, typically “UserControl1”.
  • Mode is set to 0 for modal dialog and 1 for non-modal. Modal dialogs must complete before they return control to GTViewer; Non-modal dialogs can run simultaneously with GTViewer.
  • Flags is for future use. Currently, it should be set to 0.
  • Height is the height in pixels of the area that will be reserved in GTViewer for the display of the user control.
  • Width is the width in pixels of the area that will be reserved in GTViewer for the display of the user control.
  • X is horizontal position in the GTViewer map window at which the upper left hand corner of the user control will be displayed.
  • Y is vertical position in the GTViewer map window at which the upper left hand corner of the user control will be displayed.
Example:

[External Applications]

ActiveX|<name>|<menu Position>|<objectPath>|<mode>|<flags>|

<height>|<width>|<x>|<y>|

ActiveX=Valve Isolation Trace|1|GTV_ElectGasDemos.ValveIsolation|

1|0|250|450|0|0

ActiveX=Highlight By Phase|1|GTV_HiliteByPhase.UserControl1|

1|0|270|220|0|0

ActiveX=Pole Inspection/New Pole|1|GTV_PoleInspection.UserControl1|

1|0|480|340|0|0|



No comments: