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

Re: sizing cw_field or aligning fsc_field



melissa (nischan@ll.mit.edu) writes:

> I am trying to build a GUI with several text input boxes arranged in a column, 
> with the labels above the text box.  I'd like all of the boxes to be the same 
> size, regardless of the length of the label above it.  I was also hoping to be 
> lazy and only write one line to define each box (I have a bunch of them).  In 
> other words, I know I can do it like this:
>                 widget_label(base, value='Box 1')
>                 widget_text(base, xsize=5, ysize=1)
> 
> but I was hoping for something like this:
>                 cw_field(base, title='Box 1', xsize=5, ysize=1, /column)
> 
> but when I use that, the size of the box is tied to the length of the title, 
> no matter what I set xsize to.  I also tried using David Fannings fsc_field
> function:
>                 fsc_field(base, title='Box 1', xsize=5, ysize=1, /column)
> 
> which does size the box correctly (and *looks* editable, a distinct improvement 
> over cw_field...) but it centers the box under the label.  Is there a way to 
> left align the box under the label?  (I tried setting base_align_left in the 
> base widget definition, as well as setting the label_left flag, but neither 
> helped).
> 
> Or, is there a way to get cw_field to let me choose the box size?

Perhaps if the author of FSC_FIELD has acutally followed 
through with the changes to the program he had documented
as LABEL_LEFT and LABEL_RIGHT, instead of going out for
one of those micro-brews downtown, things would have worked
out better for you. :-(

If you download a better version of FSC_FIELD here:

   http://www.dfanning.com/programs/fsc_field.pro

Then I think you will find it will work as advertised. 
Here is a test program that shows how to achieve the
effect you are looking for:

********************************************************
PRO test
tlb = Widget_Base(/column)
base = Widget_Base(tlb, /Column, Base_Align_Left=1)
id = fsc_field(base, title='Box 1', xsize=5, ysize=1, $
   /column, /align_left, /label_left)
id = fsc_field(base, title='Box 10', xsize=5, ysize=1, $
  /column, /align_left, /label_left)
id = fsc_field(base, title='Box 800', xsize=5, ysize=1, $
  /column, /align_left, /label_left)
id = fsc_field(base, title='Box 12000', xsize=5, ysize=1, $
   /column, /align_left, /label_left)
Widget_control, tlb, /Realize
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