Intel® Fortran Compiler 16.0 User and Reference Guide

WAITONMOUSEEVENT (W*S)

QuickWin Function: Waits for the specified mouse input from the user.

Module

USE IFQWIN

result = WAITONMOUSEEVENT (mouseevents,keystate,x,y)

mouseevents

(Input) INTEGER(4). One or more mouse events that must occur before the function returns. Symbolic constants 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

keystate

(Output) INTEGER(4). Bitwise inclusive OR of the state of the mouse during the event. The value returned in keystate can be any or all of the following symbolic constants:

  • MOUSE$KS_LBUTTON - Left mouse button down during event

  • MOUSE$KS_RBUTTON - Right mouse button down during event

  • MOUSE$KS_SHIFT - SHIFTkey held down during event

  • MOUSE$KS_CONTROL - CTRLkey held down during event

x

(Output) INTEGER(4). X position of the mouse when the event occurred.

y

(Output) INTEGER(4). Y position of the mouse when the event occurred.

Results

The result type is INTEGER(4). The result is the symbolic constant associated with the mouse event that occurred if successful. If the function fails, it returns the constant MOUSE$BADEVENT, meaning the event specified is not supported.

WAITONMOUSEEVENT does not return until the specified mouse input is received from the user. While waiting for a mouse event to occur, the status bar changes to read "Mouse input pending in XXX", where XXX is the name of the window. When a mouse event occurs, the status bar returns to its previous value.

A mouse event must happen in the window that had focus when WAITONMOUSEEVENT was initially called. Mouse events in other windows will not end the wait. Mouse events in other windows cause callbacks to be called for the other windows, if callbacks were previously registered for those windows.

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

   USE IFQWIN
   INTEGER(4) mouseevent, keystate, x, y, result
   ...
   mouseevent = IOR(MOUSE$RBUTTONDOWN,MOUSE$LBUTTONDOWN)
   result = WAITONMOUSEEVENT (mouseevent, keystate, x , y)
 !
 ! Wait until right or left mouse button is clicked, then check the keystate
 ! with the following:
 !
   if (IAND(MOUSE$KS_SHIFT,keystate) == MOUSE$KS_SHIFT)       &
  & write (*,*) 'Shift key was down'
   if (IAND(MOUSE$KS_CONTROL,keystate) == MOUSE$KS_CONTROL)   &
  & write (*,*) 'Ctrl key was down'