Andrew, you can get very manageable scrollbars for very large plot windows in IDL, but you have to implement an IDL widget program to get these. If you are doing nothing but scrolling - i.e., using the mouse on the scroll bar - then the widget program equivalent of WINDOW can be as simple as this:
; Create some demo sine wave data
x = findgen(10000)
y = (x mod 360) * !DTOR
; The next five calls provide a scrollable substitute for a simple WINDOW call
tlb = widget_base(/COLUMN)
wDraw = widget_draw(tlb, XSIZE=10000, YSIZE=400, $ ; 10,000 x 400 canvas ...
X_SCROLL_SIZE=400, Y_SCROLL_SIZE=400) ; ... displayed in a 400 x 400 window
widget_control, tlb, /REALIZE
widget_control, wDraw, GET_VALUE=winID
wset, winID
; Finally, the PLOT call that fills the 10,000 x 400 canvas
plot, x, sin(y), XTICKS=50, YTICKLEN=0.002
This widget program is particularly easy because a program does not have to implement an event handler, if all that is wanted is scrollbar functionality. If, however, Andrew, you really wanted to implement the functionality that captures keyboard events, like 'Page Up/Down' presses, then you have to get into a more complicated version of the above, which requires the following additional steps:
1. You would have to add an XMANAGER event listener call after the code block above.
2. You would have to add an event handler routine to your program.
3. You would have to implement your WIDGET_DRAW call above with the KEYBOARD_EVENTS=1 setting.
4. Your event handler would check the event structure's 'key' field for the value of 9 and 10 (the codes for Page Up and Page Down, respectively), perhaps 7 and 8 as well (Up Arrow and Down Arrow, resp.). When those values appeared, "WIDGET_CONTROL, GET_DRAW_VIEW=..." followed by "WIDGET_CONTROL, SET_DRAW_VIEW=..." could be executed to reposition the window view according to your own mapping of the keyboard buttons to number of pixels to be scrolled.
Even these 4 steps above can probably be implemented in ~10 lines additional of code compared to the above, but a programmer might like to do some general study of IDL widget programming in IDL's 'Building IDL Applications' manual before he/she created this more complicated scroll window.
James Jones
|