Re: forcing scroll bars in widget_draw [message #39267] |
Mon, 10 May 2004 13:29  |
btt
Messages: 345 Registered: December 2000
|
Senior Member |
|
|
David Fanning wrote:
> Ben Tupper writes:
>
>
>> It doesn't work to make the canvas equal to or smaller than
>> the viewport (in fact, I think the canvas must be quite a bit larger
>> than the viewport to get scroll bars.)
>
>
> In my tests on Windows, just a single pixel larger than the
> viewport was required to keep scroll bars around.
>
Hi David,
Hmmph, not on MaxOSX and I feel snookered. Did you try making the
canvas and viewport the same size? I wonder if the other Benjamin could
just use TVImage (etc) to center the small image on a viewport-sized
canvas?
Cheers,
The other other Benjamin
|
|
|
|
Re: forcing scroll bars in widget_draw [message #39269 is a reply to message #39268] |
Mon, 10 May 2004 13:09   |
btt
Messages: 345 Registered: December 2000
|
Senior Member |
|
|
Benjamin Hornberger wrote:
> Hi all,
>
> is there a way to force scroll bars in a draw widget even if the draw
> size is smaller than or as big as the viewport (the scroll bar should be
> inactive then)? I would like to have that because eventually the size of
> the draw area will be increased, and if the scroll bars appear just
> then, the size of the base widget would change, which is kind of ugly.
>
Hi,
You can define a 'big' drawing canvas (see XSIZE and YSIZE keywords)
with a 'small' viewing port (see X_SCROLL_SIZE and Y_SCROLL_SIZE
keywords). It doesn't work to make the canvas equal to or smaller than
the viewport (in fact, I think the canvas must be quite a bit larger
than the viewport to get scroll bars.)
The following example defines the viewport size as the image size but
defines the drawing canvas as 3 times bigger than the image size. Note
the call to WIDGET_CONTROL to change the coordinates of the viewport.
Ben
PRO ScrollTest
base = Widget_Base()
dim = [200,200]
img = BYTSCL(Hanning(Dim[0], dim[1]), top= 200B) + 55B
draw = Widget_Draw(base, $
Retain = 2, $
Xsize = dim[0] * 3, $
Ysize = dim[1] * 3, $
X_Scroll_Size = dim[0], $
Y_Scroll_Size = dim[1])
Widget_Control, base, /realize
Widget_Control, draw, Set_Draw_View = [dim[0], dim[1]]
TV, img, dim[0], dim[1]
XMANAGER, 'ScrollTest', base
END
|
|
|
|
Re: forcing scroll bars in widget_draw [message #39411 is a reply to message #39267] |
Mon, 10 May 2004 14:12  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Ben Tupper writes:
> Hmmph, not on MaxOSX and I feel snookered. Did you try making the
> canvas and viewport the same size?
Yep. Same size doesn't work. On Windows, the canvas must
be *at least* one pixel larger than the viewport to retain
scroll bars. Or else they just disappear! :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|