On Mon, 21 Feb 2005 14:35:09 -0700, David Fanning wrote:
> JD Smith writes:
>
>> Useful layout trick. Does this work for everyone? Why does Linux
>> suffer here?
>
> Suffer!? You don't even want to know! I made the mistake
> of making my Catalyst test application available. It is
> a nightmare. Private discussions lead me to conclude even
> RSI is not immune to the problems caused by differences
> in graphical user interface implementations.
>
>> Unless I realize the widgets first, and set the xsize
>> after, the labels are piled up on each other (see
>> turtle.as.arizona.edu/idl/test_pre.png and
>> turtle.as.arizona.edu/idl/test_fix.png). But even that doesn't really
>> fix it, cutting off part of the "t" in "right".
>
> I think this might be because your draw widget is probably
> slightly bigger than you think it is. In Windows, anyway,
> there is a 3 pixel "border" around the canvas of a draw
> widget, and this has to be accounted for if things are to
> align themselves. I offer my test program as an example that
> ran OK in Windows.
>
> ;*********************************************************** **********
> Pro TEST_EVENT, event
> Widget_control, event.top, Get_UValue=info
>
> Print, event.x, event.y
> Widget_Control, info.labelbase, XSIZe=event.x-6
> Widget_Control, info.draw, XSIZe=event.x
> END
>
> PRO TEST
> tlb = Widget_base(column=1, /TLB_SIze_Events)
> base = widget_base(tlb, Row=1)
> labelbase = Widget_Base(base, Column=2, /Grid, xsize=194)
> button = Widget_Label(labelbase, Value='Align Left', align_left=1)
> button = Widget_Label(labelbase, Value='Align Right', align_right=1)
> draw = widget_Draw(tlb, xsize=200, ysize=100)
> Widget_Control, tlb, /Realize, Set_UValue={labelbase:labelbase,
> draw:draw}
> Xmanager, 'test', tlb, /No_Block
> END
> ;*********************************************************** **********
>
>> Then when it gets resized, and a TLB_SIZE_EVENTS comes in, it is clearly
>> lying about the "frame-free" size of the usable window area, and the
>> widgets are resized to overfill the window (see
>> turtle.as.arizona.edu/idl/test_post.png). Does anyone at RSI actually go
>> through the layout on all of their systems to see what works?
>
> I presume you are asking a rhetorical question here. :-)
I presume you know the answer to that ;).
Your test program behaves differently, but just as poorly. I found out
that at least one of the problems is entirely unrelated to the draw
widget: grid layouts under X don't like to be resized in the least. You
can show it like this:
top=widget_base(/COLUMN)
b=widget_base(top,/GRID_LAYOUT,COLUMN=2,/FRAME)
l=widget_label(b,value='ALIGN_LEFT',/ALIGN_LEFT,/FRAME)
l=widget_label(b,value='ALIGN_RIGHT',/ALIGN_RIGHT,/FRAME)
widget_control, b,/realize
Looks fine, nicely centered and aligned. Now try:
widget_control, b,xsize=200
The rightmost box shifts inside of its frame to cut off the last
letter. Why? I'm not asking for a herculean alignment effort, merely
to increase the size of the label base. And heaven forfend that I
give the grid base an xsize to begin with (though SCR_XSIZE seems to
work initially, but not on subsequent sizings). I think RSI needs to
chain an intern to a desk this Spring and have her go through all
possible combinations of widget alignment on all platforms, and take
careful note of all the inconsistencies. Volunteers?
JD
|