- AppGraphics Documentation
- Getting Started with AppGraphics
- Window Management
- Colors and Patterns
- Mouse Interactions
- Keyboard Interaction
- Graphics Shapes and Primitives
- Text Output
- Graphic Viewports
- Images
- Windows Controls
- Common Dialogs
- Clipboard Operations
- Threads, Thread Safety, and Idling
- AppGraphics License Agreement
Mouse Interactions
These routines are used for capturing and processing mouse events from within an AppGraphics window. Please note that any mouse events that occur on a Windows control, such as a button, text box, etc., or a window’s menu will not be handled by these routines.
Many of the mouse functions below refer to the kind of mouse event to process. These parameters refer to the typeof mouse event, as defined by the following constants:
kind | Description |
MOUSE_MOVE | Mouse movement in the window |
MOUSE_LB_DBLCLK | The left button is double-clicked |
MOUSE_LB_DOWN | The left button is pushed down |
MOUSE_LB_UP | The left button is released |
MOUSE_MB_DBLCLK | The middle button is double-clicked |
MOUSE_MB_DOWN | The middle button is pushed down |
MOUSE_MB_UP | The middle button is released |
MOUSE_RB_DBLCLK | The right button is double-clicked |
MOUSE_RB_DOWN | The right button is pushed down |
MOUSE_RB_UP | The right button is released |
MOUSE_WHEEL | The mouse wheel moved |
clearmouseclick
C void clearmouseclick (kind)
Fortran subroutine clearmouseclick (kind)
Description
Clears any queued and unprocessed mouse events of a given kind.
Parameters
Parameter | C Type | Fortran Type | Description |
kind | int | integer | The type of mouse event to clear |
getmouseclick
C void getmouseclick (kind, x, y)
Fortran subroutine getmouseclick (kind, x, y)
Description
Queries for the mouse position when an event occurred. If the event did not occur, the constant NO_CLICK is returned in both the horizontal and vertical position parameters. If an event did occur, this call removes it from the mouse event queue.
Parameters
Parameter | C Type | Fortran Type | Description |
kind | int | integer | The type of mouse event for which to query the position |
x | int * | integer, intent(out) | The horizontal position of the mouse event in the window |
y | int * | integer, intent(out) | The vertical position of the mouse event in the window |
ismouseclick
C bool ismouseclick (kind)
Fortran function ismouseclick (kind)
Description
Determines if there are mouse events of the specified kind currently awaiting processing. This call will not remove the event from the mouse event queue.
Parameters
Parameter | C Type | Fortran Type | Description |
kind | int | integer | The type of mouse event for which to query |
Return Value
C bool
Fortran logical
Returns true if a mouse event of the desired kind has occurred
mousex
C int mousex ( )
Fortran function mousex ( )
Description
Returns the current horizontal mouse position in the window. This call does not affect any mouse event queues.
Return Value
C int
Fortran integer
The horizontal mouse position
mousey
C int mousey ( )
Fortran function mousey ( )
Description
Returns the current vertical mouse position in the window. This call does not affect any mouse event queues.
Return Value
C int
Fortran integer
The vertical mouse position
registermousehandler
C void registermousehandler (kind, h)
Fortran subroutine registermousehandler (kind, h)
Description
Registers a function to be called whenever a mouse event of kind occurs. The event will still be added to the mouse event queue. The handler can always clear these events itself using clearmouseclick.
If the kind parameter is MOUSE_WHEEL, the passed position will actually include the mouse wheel change in the x argument and 0 in the y argument.
Parameters
Parameter | C Type | Fortran Type | Description |
kind | int | integer | The type of mouse event to handle |
h | void h(x, y) | subroutine h(x, y) | A function that accepts the mouse position at the time of the event as int or integer parameters |
setcursor
C void setcursor (kind)
Fortran subroutine setcursor (kind)
Description
Sets the mouse cursor to the desired type. Note that the mouse cursor should always be set to the default, CURSOR_ARROW, whenever the mouse leaves the AppGraphics window.
The cursor can be set programatically to one of the following:
Id | Description |
CURSOR_STANDARD | The default system arrow |
CURSOR_CROSSHAIR | A fine cross |
CURSOR_IBEAM | A common text selection cursor |
CURSOR_HAND | A pointer shaped like a hand |
CURSOR_HELP | An arrow accompanied by a question mark |
CURSOR_WAIT | An hourglass |
CURSOR_NO | A circle with a slash |
CURSOR_SIZE_NS | A two-sided arrow arranged vertically |
CURSOR_SIZE_EW | A two-sided arrow arranged horizontally |
CURSOR_SIZE_NWSE | A two-sided arrow pointing in the upper left and lower right directions |
CURSOR_SIZE_NESW | A two-sided arrow pointing in the upper right and lower left directions |
Any values outside the list above will result in the standard arrow being displayed.
Parameters
Parameter | C Type | Fortran Type | Description |
kind | int | integer | The type of mouse cursor to display |
setmousequeuestatus
C void setmousequeuestatus (kind, status)
Fortran subroutine setmousequeuestatus (kind, status)
Description
For a given kind of mouse event, sets whether such events will be queued. If queuing is disabled (the default), only the latest mouse event of each type is stored.
The kind parameter may not be MOUSE_WHEEL.
Parameters
Parameter | C Type | Fortran Type | Description |
kind | int | integer | The type of mouse event to enable/disable queuing |
status | bool | logical | True to enable queuing events, false to store only the latest mouse event |