GPLOT recipes: The interactive cursor with keyboard commands

The cursor is most frequently used to inform the user what the world coordinates are of a position that is pointed by the mouse if you click a mouse button. It can also be used to set markers by hand. But the world coordinates that are returned can also be used to define a keyboard action where a position is wanted. This way you can use GPLOT, and an output device like the X11 screen, as an interactive drawing program. Here is a simple example. First select the device:
   COMMAND=device x11
Then, for example, define keyboard key 'd' as a draw command with
   COMMAND=curtxt #D draw %.2f %.2f
curtxt is the command that stores the text. The text can be defined either with #d or #D. draw is the command and %.2f is the C-type number format used to display the world coordinates as returned by the cursor (so that these can be edited). Now start the interactive cursor: