Re: Newline in widget_text [message #43756] |
Wed, 27 April 2005 09:22 |
kBob
Messages: 3 Registered: April 2005
|
Junior Member |
|
|
I have displayed multi-line text in the WIDGET_TEXT using special
characters and/or creating a text array. I find it's important that the
XSIZE and YSIZE are set. See sample IDL code below.
Wish we could do color in the WIDGET_TEXT, but I haven't seen how,
yet.
Kelly Dean
Fort Collins, Colorado
------------------------------------------------------------ -
PRO TryIt_event, event
;
thisevent = TAG_NAMES( event, /STRUCTURE)
CASE thisEvent OF
'WIDGET_BUTTON' : BEGIN
Widget_control,event.top, /Destroy
END
ELSE : BEGIN
PRINT, 'Unknown event ', thisEvent
END
ENDCASE
END
;
;-------------------------------------------
;
PRO TryIT
;
cmdot = STRING([183B]) ; Middle dot
cbullet = STRING([149B]) ; Bullet
ctab = STRING([9B]) ; tab
ccr = STRING(13B) ; Carriage Return
clf = STRING([10B]) ; line feed
;
; Array method
;
txtLine = 'Array Method '
txtArr = txtLine
txtLine = cbullet + Systime()
txtArr = [txtArr, txtLine ]
txtLine = ctab + cmdot + ' I tabbed '
txtArr = [txtArr, txtLine ]
;
; Special characters
;
txtSpl = 'Special Char Method' + ccr + clf
txtSpl = txtSpl + cbullet + Systime() + ccr + clf
txtSpl = txtSpl + ctab + cmdot + ' I tabbed ' + ccr + clf
;
;
wBase = WIDGET_BASE( Title='Text Widget', /Column )
NotUsed = WIDGET_TEXT( wBase, VALUE=txtArr) ; Notice, this doesn't work
Notused = WIDGET_TEXT( wBase, VALUE=txtArr, XSIZE=30, YSIZE=3) ;
Specifing size important
NotUsed = WIDGET_TEXT( wBase, VALUE=txtSpl) ; Notice, this doesn't work
NotUsed = WIDGET_TEXT( wBase, VALUE=txtSpl, XSIZE=30, YSIZE=3) ;
Specifing size important
Notused = WIDGET_BUTTON( wBase, VALUE='Done' )
;
WIDGET_CONTROL, wBase, /REALIZE
XMANAGER, 'TryIt', wBase
;
END
|
|
|
Re: Newline in widget_text [message #43761 is a reply to message #43756] |
Wed, 27 April 2005 05:51  |
btt
Messages: 345 Registered: December 2000
|
Senior Member |
|
|
photosalex@freenetname.co.uk wrote:
>
> could anybody tell me how I create a multi-line text in widget_text?
> The question is basically how to make a text begin from a new line
> where I want it.
Hello,
A couple of thoughts to share...
(1) You can specify the VALUE of the text widget as an array - the array
should appear on screen with one line per array element.
(2) If you want to append text string(s) to the the text already shown
you can use the APPEND keyword when using WIDGET_CONTROL to set the
VALUE. I use this in some applications with a scrolling text widget to
show a save-able output log.
Cheers,
Ben
|
|
|
Re: Newline in widget_text [message #43762 is a reply to message #43761] |
Wed, 27 April 2005 05:44  |
photosalex
Messages: 6 Registered: April 2005
|
Junior Member |
|
|
Thanks, Jeff, for the answer, but this doesn't work, the text appears
simply as This!CText
Jeff N. wrote:
> If you want the string "This Text" to show up as
>
> This
> Text
>
> I think you need to use "This!CText". I think that's right anyway,
I'm
> going from memory here.
>
> Jeff
>
>
> photosalex@freenetname.co.uk wrote:
>> Hello,
>>
>> could anybody tell me how I create a multi-line text in
widget_text?
>> The question is basically how to make a text begin from a new line
>> where I want it.
>>
>> Thanks a lot!
|
|
|
Re: Newline in widget_text [message #43767 is a reply to message #43762] |
Tue, 26 April 2005 10:10  |
Jeff N.
Messages: 120 Registered: April 2005
|
Senior Member |
|
|
If you want the string "This Text" to show up as
This
Text
I think you need to use "This!CText". I think that's right anyway, I'm
going from memory here.
Jeff
photosalex@freenetname.co.uk wrote:
> Hello,
>
> could anybody tell me how I create a multi-line text in widget_text?
> The question is basically how to make a text begin from a new line
> where I want it.
>
> Thanks a lot!
|
|
|