Re: Scroll bars in scalable draw widgets [message #11646] |
Wed, 20 May 1998 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Anders Johannesson (ajo@svep.se) writes:
> I'm looking for a way to work with a scalable draw_widget
> so that I can add scroll bars whenever the user scales the
> widget to something smaller than the image. In this application
> I don't want to scale the image.
>
> I know that you
> can set scroll keywords while defining the draw_widget, but I
> cannot find any way of changing this with widget_control
> in the event handler modules.
This question interested me, so I spent some time trying
to make it work. It turned out to be more difficult than
I had anticipated for several reasons.
What I ended up doing was this. If I needed scroll bars
(i.e, the user sizes the draw widget to be smaller than
the image), I destroyed the old draw widget and built
another with scroll bars. I'm not sure it is kosher
widget programming style to destroy a widget like this,
but I know that Windows is more forgiving than some
operating systems with these kinds of manipulations
and I am running a Windows NT 4.0 system.
As it happens, although Windows is forgiving, IDL was
less so. I could not get this to work at all in IDL 5.0.3,
although it appears to work correctly in IDL 5.1. In
5.0.3 I could get the scroll bar effect I was looking
for, but I couldn't get viewport events generated after
adding and deleting scroll bars a couple of times.
Interestingly enough, if I have a small window with
scroll bars and I resize it to be much larger, the
scroll bars disappear. This is *exactly* what I want,
of course, but I don't know *why* it is happening!
I hate to publish this code, since it is probably
illegal as hell to be doing what I am doing, but
I have sent it to Anders in a private e-mail. If
anyone else is interested, let me 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/
|
|
|