plevent
is the user's interrupt routine
| parameter | type | units | description |
|---|---|---|---|
| xpointer,ypointer | float | uu | position of the mouse cursor at the moment of the interrupt |
| event_code | int | -- | value of the code that caused the interrupt |
| returns: | void |
Description
plevent is the user's interrupt routine. The standard one, delivered with the SIMPLOT-package only shows the position of the mouse cursor, until the q-key is hit which then causes the application to exit. The user should use a copy of plevent and change it to his needs. Possible values for event_code are the ASCII-values of keys and values predefined in simplot.h with self-explaining names:| ArrowDown | F1 | MouseDrag |
| ArrowLeft | F2 | MouseLeftDown |
| ArrowRight | F3 | MouseLeftUp |
| ArrowUp | F4 | MouseMiddleDown |
| Delete | F5 | MouseMiddleUp |
| End | F6 | MouseRightDown |
| Escape | F7 | MouseRightUp |
| Home | F8 | |
| Insert | F9 | |
| PageDown | F10 | |
| PageUp | F11 | |
| F12 |
- plget(EVENT_ASCII) is non-zero if the event was caused by an ASCII key
- plget(EVENT_BUTTON) is non-zero if the event was caused by a mouse button
- plget(EVENT_DOWN) is non-zero if the event was caused by a key or button being pressed
- plget(EVENT_FUNCTION) is non-zero if the event was caused by a function key
- plget(EVENT_UP) is non-zero if the event was caused by a key of button release
Examples
Here is the simplest example, using the default versions of plevent and pldraw, It shows an X window with a 'Quit' button and, with one of the mouse buttons pressed, horizontal and vertical hairlines plus the
#include <simplot.h>
int main () {
plinit(X,"",100,100,10,10,"","");
plloop();
}
See plloop for a more complex example program using several event codes.