In the Map's tool used event and poly tool used event watch for a zoom or
pan tool being used.  The event will fire prior to the tool action taking
place so you can react to the tool use and even alter the use of the tool.

I have a MapXLib.Rectangle called PreviousViewExtents and another called
CurrentViewExtents.  In the Map's ToolUsed event I look for a ToolNum of
(miZoomInTool, miZoomOutTool, miPanTool).  If one of these are found I set
the PreviousViewExtents to the Map's. Bounds i.e. "Set PreviousViewExtents =
Me.mapOrlando1.Bounds"

I have a button on my form's toolbar that acts as a previous view button.
If the user depresses that button I switch the current view for the previous
view.

    Case gisZoomPreviousToolKey
        ' Save the maps current bounds. Set the maps bounds to that of the
        ' previous view.  Set the previous views bounds to the one set
aside.
        If frmMain.mapOrlando1.Bounds.Width <> 0 Then
          Set CurrentViewExtents = frmMain.mapOrlando1.Bounds
          Set frmMain.mapOrlando1.Bounds = PreviousViewExtents
          Set PreviousViewExtents = CurrentViewExtents
        End If

If you really wanted to enhance this you could use a collection of
rectangles and a pointer to the current view in the collection.  This would
enable the user to have a history of previous views.  You can set a limit to
the number in the collection and shift each view over when adding a new view
dropping the oldest into the infinite bit bucket as it pushes past the
limit.

Good luck.

Patrick J. Phillips
GIS Programmer II
City of Orlando, FL

----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to