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

Re: Widget width in vertical base



Jonathan Joseph (jj@scorpio.tn.cornell.edu) writes:

> I just installed 5.2.1 (was using 5.1)
> and I noticed that my horizontal sliders
> in a vertical base no longer set their
> width to the width of the base.
> 
> According to the documentation:
> 
> 
>   Horizontal Size of Widgets:
> 
>   If any of the BASE_ALIGN_* keywords to WIDGET_BASE is set, each
>   widget has its "natural" width, determined either by the value of
>   the widget or by the XSIZE keyword. Similarly, if any of the child
>   widgets specifies one of the ALIGN_* keywords, that widget will have
>   its "natural" width. If none of the BASE_ALIGN_* or (ALIGN_*) 
>   keywords are set, all widgets in the base are as wide as their
>   column.
> 
> I removed all "*align*" keywords, but this did not solve
> the problem.  The sliders remain their mundane size (100 pixels
> I think).
> 
> Anyone else notice this problem or know a solution?

Although I have been a loud and vocal advocate of NOT
using specific sizing in widget programs, I will be
the first to admit that opening yourself up to the
natural sizing of widgets in cross-platform and
cross-version development efforts is a recipe for
disaster. :-(

Thus, for size-critical widgets, I've developed
a hybrid technique. I lay things out in the normal
Column/Row bases I've always advocated. But at the
end, just before I realize the widget hierarchy,
I find out just how big a particular widget is by
getting it's geometry. Then, I might size a particular
widget to be a certain percentage of this size.

For example, suppose I have a label next to a text
widget in a row text base. And I want the text widget
sized so that it is 80 percent of the draw widget
just below it in the program, which should be just
as long as the text base. I might do something like
this:

   dGeom = Widget_Info(drawID, /Geometry)
   Widget_Control, textbaseID, Scr_Xsize=dGeom.scr_xsize
   Widget_Control, textID, Scr_Xsize=dGeom.scr_xsize * 0.8

That gives me some control without completely destroying
all the advantages of the column/row paradigm.

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