resizing draw widget [message #10534] |
Wed, 17 December 1997 00:00  |
Cathy Campo
Messages: 7 Registered: October 1997
|
Junior Member |
|
|
i am trying to resize a draw widget. when i originally create the
base and draw widget, i do this
base = widget_base(title='Data', xoffset=xoffset, yoffset=yoffset, $
/column, xsize=x_scroll_size)
draw = widget_draw(base, /scroll, x_scroll_size=x_scroll_size, $
y_scroll_size=y_scroll_size, retain=2, xsize=xsize, ysize=ysize)
when i want to resize the draw widget, i recalculate a new xsize,
ysize, then i do this
; adjust size of drawable area
widget_control, draw, draw_xsize=xsize, draw_ysize=ysize
; adjust viewport size
widget_control, draw, xsize=x_scroll_size, ysize=y_scroll_size
; adjust base size
widget_control, base, size=x_scroll_size
the base is resizing correctly, but the draw widget is staying the
old size. any suggestions?
Cathy Campo
General Atomics
San Diego, CA
campo at gav dot gat dot com
phone (619) 455-3340
|
|
|
Re: resizing draw widget [message #10676 is a reply to message #10534] |
Thu, 18 December 1997 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Cathy Campo (campo@gav.gat.com) writes:
> i am trying to resize a draw widget. when i originally create the
> base and draw widget, i do this
>
> base = widget_base(title='Data', xoffset=xoffset, yoffset=yoffset, $
> /column, xsize=x_scroll_size)
> draw = widget_draw(base, /scroll, x_scroll_size=x_scroll_size, $
> y_scroll_size=y_scroll_size, retain=2, xsize=xsize, ysize=ysize)
>
> when i want to resize the draw widget, i recalculate a new xsize,
> ysize, then i do this
>
> ; adjust size of drawable area
> widget_control, draw, draw_xsize=xsize, draw_ysize=ysize
> ; adjust viewport size
> widget_control, draw, xsize=x_scroll_size, ysize=y_scroll_size
> ; adjust base size
> widget_control, base, size=x_scroll_size
>
> the base is resizing correctly, but the draw widget is staying the
> old size. any suggestions?
I'm unclear from your description exactly what you are
trying to do. If you have new xsize and ysize values
(larger), but the same x_scroll_size and y_scroll_size
values, then what you have done in the code above is
resized the draw widget canvas (drawing area) and left its
viewport size the same. In this case, the draw widget would
not appear to change size on the display, although it
would certainly have more drawing area (i.e., it is
larger than it was before.)
I presume from your complaint that this is not what you
intended to do. If you want to leave the drawing area
or canvas the same size, but make the view into the
drawing area (viewport) larger, then set the XSize and
YSize keywords to the new sizes.
This is all made more complicated than it needs to be by
the fact that the keywords XSIZE and YSIZE size the canvas
or drawing area when used with WIDGET_DRAW, but size the
viewport when used with WIDGET_CONTROL. (Uh, don't ask me
why, I don't know.)
Cheers,
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|