Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

REGISTERMOUSEEVENT

QuickWin Function: Registers the application-supplied callback routine to be called when a specified mouse event occurs in a specified window. This routine is only available for Windows.

Module

USE IFQWIN

result = REGISTERMOUSEEVENT (unit,mouseevents,callbackroutine)

unit

(Input) INTEGER(4). Unit number of the window whose callback routine on mouse events is to be registered.

mouseevents

(Input) INTEGER(4). One or more mouse events to be handled by the callback routine to be registered. Symbolic constants (defined in IFQWIN.F90) for the possible mouse events are:

  • MOUSE$LBUTTONDOWN - Left mouse button down

  • MOUSE$LBUTTONUP - Left mouse button up

  • MOUSE$LBUTTONDBLCLK - Left mouse button double-click

  • MOUSE$RBUTTONDOWN - Right mouse button down

  • MOUSE$RBUTTONUP - Right mouse button up

  • MOUSE$RBUTTONDBLCLK - Right mouse button double-click

  • MOUSE$MOVE - Mouse moved

callbackroutine

(Input) Routine to be called on the specified mouse event in the specified window. It must be declared EXTERNAL.

Results

The result type is INTEGER(4). The result is zero or a positive integer if successful; otherwise, a negative integer that can be one of the following:

  • MOUSE$BADUNIT - The unit specified is not open, or is not associated with a QuickWin window.

  • MOUSE$BADEVENT - The event specified is not supported.

For every BUTTONDOWN or BUTTONDBLCLK event there is an associated BUTTONUP event. When the user double clicks, four events happen: BUTTONDOWN and BUTTONUP for the first click, and BUTTONDBLCLK and BUTTONUP for the second click. The difference between getting BUTTONDBLCLK and BUTTONDOWN for the second click depends on whether the second click occurs in the double click interval, set in the system's CONTROL PANEL/MOUSE.

Example

The following example registers the routine CALCULATE, to be called when the user double-clicks the left mouse button while the mouse cursor is in the child window opened as unit 4:

  USE IFQWIN
  INTEGER(4) result
  OPEN (4, FILE= 'USER')
  ...
  result = REGISTERMOUSEEVENT (4, MOUSE$LBUTTONDBLCLK, CALCULATE)