GINO Graphics Suite - GINO v9.0  

gGetEventRecord

Syntax

[C/C++:]
void gGetEventRecord(int intype, GEVEREC *everec);
[F90:]
subroutine gGetEventRecord(intype, everec)

integer, intent(in) :: intype
type (GEVEREC), intent(out) :: everec

Arguments

intype
Event type

= GNULL, Null event type
= GKEYPRESS, Key or mouse button press (key)
= GSEGMENT, Picture segment number (nseg)
= GSEGMENTANDKEY, Picture segment number and key/mouse button (key,nseg)
= GLOCATOR, Screen position and key/mouse button press (key,pos)
= GSTRING, Text string (nargs,iargs)
= GREALS, String of real values (nargs,args)
= GINTEGERS, String of integer values (nargs,iargs)
= GMOVEMENT, Pointer, mouse or tablet movement (pos)
= GKEYRELEASE, Key or mouse button release (key,pos)
= GRESIZE, Window resize event (nargs,args)
= GPOINTERLEAVING, Pointer leaving window (pos)
= GPOINTERENTERING, Pointer entering window (pos)

everec.key
ASCII key code

= 0, Undefined

everec.impkey
Identifier of implement on which key was pressed

= -1, Undefined

everec.impdat
Identifier of implement from which data was supplied

= -1, Undefined

everec.nseg
Picture segment number

= -1, Undefined

everec.pos
Screen position in picture coordinates

= (0.0,0.0), Undefined

everec.nargs
Number of data values in args or iargs

= 0, No data

everec.args[80]
A real array of data

everec.iargs[80]
An integer array of data

Description

The routine gGetEventRecord() will return appropriate event data after a call to gWaitForEvent(), gDragSeg() or gGetCursorEvent(). intype specifies the type of event data that should be returned.

After a call to gWaitForEvent(), intype should be set to the value returned by that routine. After a call to gDragSeg() or gGetCursorEvent(), intype should be set to GLOCATOR. If intype is set to GNULL or is out of range, the event record is set for the null data type, which corresponds to the values 0,-1,-1,-1,0.0,0.0 and 0. If intype is out of range, an error message is output.

Each event data type defines some but not all of the return parameters as indicated above. Any undefined parameters will be set to the value corresponding to the null data type.

everec.key returns the key/button pressed or released corresponding to the following table of keyboard/mouse keys:

key       Keyboard key                                 
0-127     Standard 7-bit ASCII character

76,77,82  Left/Middle/Right mouse button
513-532   Function keys 1-20 (i.e. function key n +512)
533-536   Left/Right/Up/Down arrow key
537,538   Page Up/Down or Prior/Next
539       Insert
540,541   Home/End
542       Shift TAB

544       Numerical Key Pad /
545       Numerical Key Pad *
546       Numerical Key Pad -
547       Numerical Key Pad +
548       Numerical Key Pad 'Enter'
549       Numerical Key Pad .
550-559   Numerical Key Pad 0-9

560      Print Screen
561      Pause
562      Select
563      Execute
564      Help


The following keyboard combinations are also returned in everec.key, but where the required combination is not catered for it is suggested that the function gEnqKeyState() is used.

key      Keyboard Key                                    
n+64     Shift + special key > 511 (i.e. Shift F1 = 577)
n-64     Ctrl + special key > 511 (i.e. Ctrl F1 = 449)
n+1024   Alt + any key (i.e. Alt P = 1104, Alt F1 - 1537)


If no key was typed, everec.key= 0.

everec.impkey and everec.impdat are set to the implement types of the devices that supplied the key and data associated with the event. If no key was typed, or no data was supplied, the identifier(s) is returned as -1.

Implement types are as follows:-

0      Screen
100    Keyboard
200    Function Box
300    Light Pen
400    Joystick/arrow keys/thumb wheel/mouse
500    Tablet/Digitizer
600    Valuator


everec.nseg is set to the picture segment number concerned in the event. If no picture segment is relevant, everec.nseg is set to -1. everec.pos is the picture coordinates of the position being returned and are set to -1.E-6 if no position is being returned.

All further information is stored in array everec.args or everec.iargs, the variable everec.nargs giving the number of elements relevant to this event. If everec.nargs is set to zero, there are no data values returned in everec.nargs or everec.iargs, and no attempt should be made to access any element of these data arrays. For a text string, everec.iargs contains the ASCII codes of the string entered and for event GRESIZE, the first two elements of everec.args contain the width and height of the resized window in picture coordinates.

See Also

gGetEventRecord Usage
gDragSeg
gEnqKeyState
gWaitForEvent