Fanning Software Consulting

Obtaining the Draw Widget's Viewport Coordinates

QUESTION: How can I get the new viewport coordinates when the user scrolls my draw widget?

ANSWER: The new coordinates are returned with the Get_Draw_View keyword to the Widget_Control procedure. The return value is a two-element array with the X and Y coordinates of the lower-left corner of the visible image on the larger canvas.

Put this code into your draw widget's event handler:

   Widget_Control, event.id, Get_Draw_View=thisView
   Print, thisView

Google
 
Web Coyote's Guide to IDL Programming