[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TLB Widget resizing



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.]