q pos

q pos

After this command is issued, GrADS waits for user's mouse click, then returns the coordinates of the mouse click plus additional information. If the nowait argument is used, then GrADS will query the mouse without waiting for a mouse click. The returned information makes 'q pos' such a powerful command especialy when used in conjunction with the different 'classes' of widgets: buttons, rubber bands, and dropmenus. Here is a template of the information that 'q pos' returns after a mouse click (note the difference in output between the different widget classes):

Position = xpos ypos mbtn class                                    (somewhere in the graphics window)
Position = xpos ypos mbtn class widget# btnstate                   (for buttons)
Position = xpos ypos mbtn class widget# xpos2 ypos2                (for rbands)
Position = xpos ypos mbtn class widget# menuitem <casc# cascitem>  (for dropmenus)

where:

Usage Notes

  1. If the user did not click on a widget, then class will be 0 and there will be no further output.

  2. If the user clicks on a dropmenu but no menu item is selected, then widget# and menuitem will both be -1.

  3. There can be up to three levels of nested cascading dropmenus launched from the main dropmenu. In other words, casc# and cascitem will repeat up to three times in the output from 'q pos'.

  4. The following reference pages contain information on configuring and drawing the widgets:
    set button
    draw button
    redraw button
    set rband
    set dropmenu
    draw dropmenu

Examples

See the section of the User's Guide on widgets for plenty of script examples showing how to use 'q pos'.