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 (for dropmenus)
where:
xpos, ypos - coordinates of the mouse click in real page unitsmbtn - either 1, 2, or 3 for the left, center, or right mouse buttonclass - either 1, 2, 3, or 0 for button, rband, dropmenu, or 'not a widget'widget# - the number assigned to the widget when it was originally set upbtnstate - either 0 (meaning "off") or 1 (meaning "on")xpos2, ypos2 - coordinates of the mouse release point in virtual page unitsmenuitem - the item number selected from the menu listcasc# - the cascade menu number selected from the dropmenu listcascitem - the item number selected from the cascade menuclass will be 0 and there will be no further output.
widget# and menuitem will both be -1.
casc# and cascitem will repeat up to three times in the output from 'q pos'.
set buttondraw buttonredraw buttonset rbandset dropmenudraw dropmenu
See the section of the User's Guide on widgets for plenty of script examples showing how to use 'q pos'.