comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: TLB Widget resizing
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: TLB Widget resizing [message #16790] Tue, 17 August 1999 00:00
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
davidf@dfanning.com (David Fanning) writes:
> Here is my (I hope) helpful suggestion: Put some minimum X and Y
> base size values in your info structure. Refuse to allow anything
> to size itself smaller than this minimum size. I'd have
> code something like this:
>
> PRO TEST_RESIZE, event
> Widget_Control, event.top, Get_UValue=info, /No_Copy
> Widget_Control, info.drawID, Draw_XSize=(event.x > info.minXsize), $
> Draw_YSize=(event.y > info.minYsize)
> Widget_Control, event.top, Set_UValue=info, /No_Copy
> END

Right. I might have been chasing my tail more than I needed to.
Something interesting did come up in my trevails however.

I think I have found another work-around for the dreaded expanding
widget bug. [ As a summary, the bug is that resizable widgets will
grow an *extra* amount every time their size is adjusted. ]

Make sure your top-level base has XPAD=0 and YPAD=0 upon
initialization. That removes any margin spacing in the top level
base, and seems to solve at least part of the expanding widget
problem. If you do need margin spacing, then you can encapsulate
everything in another base widget, using the default XPAD and YPAD.

Example code:
tlb0 = widget_base( title='Resize Example', $
tlb_size_events=1, column=1, xpad=0, ypad=0 )
tlb = widget_base(tlb0, column=1)

Now, put everything in tlb instead of tlb0.

Unfortunately this doesn't solve the problem of widget windows with
menus. Apparently menus are also considered to be padding.

Craig

[ copy to David Fanning ]
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: TLB Widget resizing [message #16792 is a reply to message #16790] Tue, 17 August 1999 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Craig Markwardt (craigmnet@cow.physics.wisc.edu) writes:

> I have a different question however. There appear to be times when
> you can resize a window to *smaller* than it is supposed to be. That
> is, try to resize a window so that there is no way for all of the
> component widgets to fit.
>
> In that case, you do get a resize event which describes the size of
> the new, small window. For a moment on my Linux screen, the window
> does get smaller. However, IDL smartly decides that the component
> widgets can't fit inside, and the window "bounces" back to a larger
> size. It grows to a new size -- BUT a resize event is NEVER SENT.
>
> Who cares right? Well, I have a draw widget that is resized based on
> the (incorrect) numbers in the resize event. When the window
> "bounces" to a new size, the resulting draw widget looks pretty goofy.
> You can reproduce this in David Fanning (and my) XWINDOW program, and
> also with the following RESIZE program, based on work by Liam Gumley.
> Just run it, and resize the window to a very small width.
>
> Can anybody suggest a way to get a new resize event? I have
> considered requesting a timer event to periodically adjust the draw
> widget's dimensions.

Here is my unhelpful suggestion first: get a PC. Mr. Gates
has already thought about this situation and has determined
you will never be able to make this mistake, ever. :-)

Here is my (I hope) helpful suggestion: Put some minimum X and Y
base size values in your info structure. Refuse to allow anything
to size itself smaller than this minimum size. I'd have
code something like this:

PRO TEST_RESIZE, event
Widget_Control, event.top, Get_UValue=info, /No_Copy
Widget_Control, info.drawID, Draw_XSize=(event.x > info.minXsize), $
Draw_YSize=(event.y > info.minYsize)
Widget_Control, event.top, Set_UValue=info, /No_Copy
END

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155

[Note: This follow-up was e-mailed to the cited author.]
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: seperators in menus
Next Topic: Re: IDL 5 Syntax ?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Mon Oct 13 11:20:31 PDT 2025

Total time taken to generate the page: 1.60013 seconds