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

Re: TLB Widget resizing

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.


[ copy to David Fanning ]
Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response