Handling TerraExplorer Events

The following sample shows the use of the _ITerraExplorerEvents5::OnLoadFinished() event notification as well as the FlyName property of the ITerraExplorer interface.

 

Note: The name of the event handler subroutine must be combined from the name of the TerraExplorer object (in this example “TE”), underline and the name of the method (without the name of the events interface). There are other ways to handle events. Please refer to your VB Script guide for further information.

 

<HTML>
This page displays a message box when loading a FLY file into TerraExplorer
 

<SCRIPT Language="VBSCRIPT">
sub TE_OnLoadFinished()
   Set ITerraExplorer = TE.interface("ITerraExplorer")
   msgbox "File loaded:    " + ITerraExplorer.FlyName
end sub
</SCRIPT>

<BODY>
<OBJECT ID="TE" CLASSID="CLSID:3a4f9191-65a8-11d5-85c1-0001023952c1"></OBJECT>
</BODY>

</HTML>

 

The following sample shows the use of the _ITerraExplorerEvents4::OnTerraExplorerMessage() event notification.

 

<HTML>

This page displays a message box when TerraExplorer triggers a text message.

It then sets TerraExplorer to not handle the message internally.

 

<SCRIPT Language="VBSCRIPT">

sub TE_OnTerraExplorerMessage(TEMessageID, SourceObjectID, bHandled)

   Set IObjectManager51 = TE.interface("IObjectManager51")

   Set TEObject = IObjectManager51.GetObject(TEMessageID)

   'MsgType = TEObject.Type

   if TEObject.Type = 0 then

       msgbox "Message Text: " + TEObject.Text

       bHandled = true

   end if

end sub

</SCRIPT>

 

<BODY>

<OBJECT ID="TE" CLASSID="CLSID:3a4f9191-65a8-11d5-85c1-0001023952c1"></OBJECT>

</BODY>

 

</HTML>