CimEvent.GetMouseEvent (function)

Obsolete

Replaced by a GefEventContext.

Syntax

CimEvent.GetMouseEvent(xPos, yPos, mouseFlags)

Description

Retrieves information about the mouse. Returns a Boolean indicating if the mouse parameters retrieved are valid. This will only return TRUE if the event type is CIM_ET_MOUSE_DOWN or CIM_ET_MOUSE_UP or CIM_ET_WHILE_MOUSE_DOWN.

Comments

The xPos parameter is a Long passed ByRef that receives the x position of the mouse.

The yPos parameter is a Long passed ByRef that receives the y position of the mouse.

The mouseFlags parameter is a Long passed ByRef that receives the flags indicating which mouse button are down and the states of the shift and control keys. These states are indicated by using the And operator and the following constants.

For the left mouse button  CIM_MF_LBUTTON.

For the right mouse button CIM_MF_RBUTTON.

For the shift key  CIM_MF_SHIFT.

For the control key CIM_MF_CONTROL.

For the middle mouse button CIM_MF_MBUTTON.

Note the units for the coordinates of the mouse are 1/20 of a point. These coordinates are scaled by the zoom factor of the view, and the origin of the coordinate system is the lower left corner of the CimView document. The effect of this coordinate mapping is to supply coordinates that are constant relative to the objects in the document. For example, if there is a square in the document with its top left corner at xPos = 1000 and yPos = 3000 and the user clicks on the top left corner of the square the coordinates of the mouse will be reported as xPos = 1000 and yPos = 3000 regardless of the zoom factor and scrolled position of the view.

Example

Dim xVar As CimObjectVariable

Dim yVar As CimObjectVariable

Set xVar = cimOwnerObj.GetVariable("xVar")

Set yVar = cimOwnerObj.GetVariable("yVar")

Dim pState As Boolean

Dim x As Long

Dim y As Long

Dim f As Long

If cimEvent.GetMouseEvent(x, y, f) Then

  pState = CimAutoUpdateScreen(FALSE)

  xVar = x

  yVar = y

pState = CimAutoUpdateScreen(pState)

  If f And CIM_MF_CONTROL Then

    'The control key is down

    'So do some other stuff…

  End If

End If

More information

Obsolete basic extensions.