Share via


BeforeClick event

Occurs after the user clicks on the map but before MapPoint has processed the action. Allows the user to cancel the action.

Applies to

Objects:  Map, MappointControl

Syntax

object.BeforeClick(Button, Shift, X, Y, Cancel)

Parameters

Part Description
object An expression that evaluates to a Map or MappointControl object.
Button ByVal Long. An integer that corresponds to the state of the mouse buttons. A bit is set if the button is down. The Button argument is a bit field with bits corresponding to:
GeoMouseButtonConstants Description Value Bit
geoLeftButton Left button
1
0
geoMiddleButton Middle button
4
2
geoRightButton Right button
2
1
geoXButton1 1st X button
8
3
geoXButton2 2nd X button
16
4

Indicates the state of the mouse buttons: one, some, or all of these five bits can be set, indicating that one, some, or all of the buttons are pressed.

Shift ByVal Long. An integer that corresponds to the state of the SHIFT, CTRL, and ALT keys. A bit is set if the key is down. The Shift argument is a bit field with the least-significant bits corresponding to:
GeoShiftConstants Description Value Bit
geoAltMask ALT key
4
2
geoCtrlMask CTRL key
2
1
geoShiftMask SHIFT key
1
0

Indicates the state of these keys: some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both CTRL and ALT were pressed, the value of Shift would be 6.

X ByVal Long. The X coordinate of the mouse pointer relative to the map window, in pixels.
Y ByVal Long. The Y coordinate of the mouse pointer relative to the map window, in pixels.
Cancel Boolean. False when the event occurs. If the event procedure sets this argument to True, the click is ignored.

Remarks

Do not make this event infinitely recursive by calling itself or causing itself to be called.

Do not create a modal dialog box—including message boxes—during this event.

Example

    Dim WithEvents objApp As MapPoint.Application
  Dim WithEvents objMap As MapPoint.Map

  Private Sub Form_Load()     'Set up the application     Set objApp = CreateObject("mappoint.application")     Set objMap = objApp.ActiveMap     objApp.Visible = True     objApp.UserControl = True   End Sub
  Private Sub objMap_BeforeClick(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long, Cancel As Boolean)     'Go to the location clicked on the map with the mouse     objMap.XYToLocation(X, Y).GoTo   End Sub