Re: Right justifying text [message #18146] |
Fri, 03 December 1999 00:00  |
Phil Aldis
Messages: 11 Registered: February 1999
|
Junior Member |
|
|
David Fanning <davidf@dfanning.com> wrote in message
news:MPG.12b0b6aa4ed8c11b9899ae@news.frii.com...
> Robert S. Mallozzi (Robert.Mallozzi@msfc.nasa.gov) writes:
>
>> If you set the size of the text area explicitly, you
>> could do something like this:
>>
>> xsize = 40
>> ysize = 1
>> base = WIDGET_BASE (/COLUMN)
>> text = WIDGET_TEXT (base, XSIZE = xsize, YSIZE = ysize, VALUE = '')
>> WIDGET_CONTROL, /REALIZE, base
>>
>> num = 10.00
>> fmt = "(F" + STRTRIM (xsize, 2) + ".2)" ; F40.2
>>
>> str = STRING (num, FORMAT = fmt)
>> WIDGET_CONTROL, text, SET_VALUE = str
>>
>> You could make the number of digits after the decimal point a
>> parameter as well; here I just hardcoded it to 2.
>
> Humm. Maybe if you have a non-proportionally spaced
> font in the text widget, but I doubt otherwise. A
> table widget allows you to justify text. Maybe
> Phil Aldis will write us a nice CW_FIELD-like compound
> widget object that uses a Table Widget rather than a text
> widget. :-)
>
As I've almost finished term for my 6 week Christmas holiday (life's so
hard) then I would have been happy to give this a go. There is one major
problem which will stop it from working however. You can't create table
widgets that don't have scroll bars and so you can't create a single
standalone cell, which could look like a CW_Field. Try this code to see what
I mean:
base = Widget_Base()
table = Widget_Table(base, XSIZE=1, YSIZE=1, VALUE=[0], ROW_LABELS=[' '],
COLUMN_LABELS=[' '], SCROLL=0)
Widget_Control, base, /REALIZE
See what I mean - it just looks messy. Well it does on windows, at least,
I'm not sure about UNIX. So I', afraid this idea's a bit of a non starter (I
think).
Cheers,
Phil
Phil Aldis,
Gonville and Caius College,
Cambridge University,
Cambridge.
CB2 1TA.
Phone: 01223 520026
E-Mail : philaldis@yahoo.com
|
|
|