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
|
|
|