For more information on this technique, see the rubberband box programming tip for regular IDL windows. In the code below , use the LEFT mouse button to draw a free-hand line in the draw widget window. The essential algorithm is this. On a draw widget DOWN event I create a pixmap and copy the display information into it, set the starting coordinate of the line, and turn motion events on for the draw widget. I want to do with the line.
All program draw widget events handled here.
Copy window contents into it. Erase the last line drawn. Destroy the pixmap. Clear events queued for widget. Reinitialize the line starting coordinates.