Re: help with text widget... [message #47395] |
Thu, 09 February 2006 20:18 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> I agree you don't want to size the text widget in pixel sizes, probably.
> But XSIZE applies to "character units" (a nebulous unit that requires
> some experience to get right), and YSIZE refers to how many lines of
> output you want. So something like this usually works for me:
>
> textID = Widget_Text(tlb, XSize=String(Replicate(32B, 50), YSize=3)
Whoops! Probably not a good idea to write answers while I'm
trying to chase the dogs to bed. How about this, instead:
textID = Widget_Text(tlb, Value=String(Replicate(32B, 50)), YSize=3)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: help with text widget... [message #47396 is a reply to message #47395] |
Thu, 09 February 2006 20:05  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Steve writes:
> I'm just starting to learn how to use widgets, and am having a little
> trouble getting a text widget to display properly. I am trying to
> avoid using absolute sizing, and would prefer to let IDL size the
> widget based on the base it's in...
>
> If I use:
> base=widget_base(column=1)
> text=widget_text(base, "line1 of text")
>
> I get a nice single line output...
>
> However, what I want is to have a widget that is blank until I need to
> print to it,
> then have it print
>
> Line 1 of text
> Line 2 of text
> Line 3 of text
>
> inside the widget. I'd like the blank initial widget to be sized
> correctly to handle 3 lines of text, without actually having any text
> displayed, or without having the widget change size. Also, as I noted
> before, I would like to avoid specifying the size of the widget in
> absolute terms (i.e.# pixels), but saying it "should be 3 lines high"
> would be great...
>
> An acceptable solution (although not as good as the above) would be to
> intially print the lines when the wiget is created. However, I can't
> even get this to work. If I use newline characters, these simply print
> on the line, and the result is still just a single line.
>
> Any help would be appreciated...
I agree you don't want to size the text widget in pixel sizes, probably.
But XSIZE applies to "character units" (a nebulous unit that requires
some experience to get right), and YSIZE refers to how many lines of
output you want. So something like this usually works for me:
textID = Widget_Text(tlb, XSize=String(Replicate(32B, 50), YSize=3)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|