I have encountered a few puzzling quirks in the Draw widget under IDL
5.0 (first full release) running on a Windows 95 platform. They have
to do with the scrolling of the viewport over a larger drawing area.
1) I need to resize the underlying drawing area at run time. I use
the widget_control procedure with the parameters draw_xsize and
draw_ysize. Everything works properly if the viewport is located at
the top left corner of the image. Otherwise, IDL appears to 'lose
track' of the location of the viewport and starts displaying bands of
grey background at the edges of the image, or in worst cases no image
at all. The effect is cumulative over repeated resizings, and there
is no way of restoring the proper positioning.
2) As a stopgap measure, I tried to have IDL reposition the viewport
to the top left corner of the image before doing the resizing, only
to discover that using widget_control with the set_draw_view
parameter works erratically and sometimes not at all. It seems that
IDL cannot shift the viewport toward smaller origin values than the
current ones.
I enclose below a sample file which generates a small draw widget
application. Clicking on the 'Toggle size' button will change the
draw area from having the same size as the viewport to being twice as
big, and back again. If the viewport is repositioned when the draw
area is enlarged, and the size is then toggled, the problem described
in point 1) above appears quite obviously.
I would sincerely appreciate having someone's opinion on this. I very
much need the resizing feature for a critical application, and I cannot
find a work-around. Does anyone know whether the problem been
addressed in 5.0.2?
Many thanks,
Roberto Racca
-------------- SAMPLE CODE. CUT HERE --------------------------------
pro testdraw_event, event
widget_control, event.id, get_uvalue = tag
case tag of
"EXIT" : widget_control, event.top, /destroy
"TOGGLE" : begin
erase, !p.background
widget_control, event.top, get_uvalue = Draw
geometry = widget_info(Draw, /geometry)
if geometry.draw_xsize eq 200 then begin
widget_control, Draw, draw_xsize = 400, draw_ysize = 400
tvscl, dist(400)
endif else begin
widget_control, Draw, draw_xsize = 200, draw_ysize = 200
tvscl, dist(200)
endelse
end
endcase
end
pro testdraw
Base1 = widget_base(title = "Test of draw widget", /column)
Base2 = widget_base(Base1, /row)
But1 = widget_button(Base2, value="Toggle size", uvalue = "TOGGLE")
But2 = widget_button(Base2, value="Exit", uvalue = "EXIT")
Draw = widget_draw(Base1, xsize=200, ysize=200, $
x_scroll_size=200, y_scroll_size=200)
widget_control, Base1, set_uvalue = Draw
widget_control, Base1, /realize
loadct, 5
tvscl, dist(200)
xmanager, "testdraw", Base1
end
--------- END OF SAMPLE CODE. CUT HERE ----------------------------
|