widget_text [message #29433] |
Thu, 21 February 2002 08:09  |
john.copley
Messages: 8 Registered: October 2001
|
Junior Member |
|
|
It seems that widget_text cannot handle reasonably large string arrays
and I'm wondering if anyone can suggest a workaround. I'd like to be
able to display string arrays with about 100,000 characters total.
Below are some lines of code where I generate an array of 1000
strings, each of which is 12*n characters in length; within a loop n
ranges from 1 to 10. I then seek to display the string array using
widget_text. For n=1-3 it's OK but for larger n the number of lines
displayed goes as follows: (n is in the first column and the number of
lines is in the last column). (This is the output from the code)
1 12 12 14000 14000.0 1000
2 24 24 26000 26000.0 1000
3 36 36 38000 38000.0 1000
4 48 48 33380 50000.0 667
5 60 60 41136 62000.0 663
6 72 72 50868 74000.0 687
7 84 84 31936 86000.0 371
8 96 96 57752 98000.0 589
9 108 108 53160 110000. 483
10 120 120 35288 122000. 289
pro test_xdisplayfile
; Number of lines desired
nl=1000
; text12 is an array of nl strings, each with 12 characters
text12=sindgen(nl)
text=text12
; Each time around we make the strings 12 characters longer
for n=1,10 do begin
if (n gt 1) then text=text+text12
; total number of characters in text (including LF/CR)
tlen=total(strlen(text)+2)
; Make a widget
top=widget_base()
wtx=widget_text(top,xsize=150,YSIZE=24,/SCROLL,VALUE=text)
widget_control,top,/realize
; Number of characters in widget
nchars=widget_info(wtx,/text_number)
; Number of lines in widget
nwlines=nchars/(12*n+2)
; Number of characters in firat and last lines.
nc0=strlen(text[0])
ncl=strlen(text[nl-1])
print,i,nc0,ncl,nchars,tlen,nwlines
widget_control,top,/destroy
endfor
end
Any ideas?
John
|
|
|
Re: widget_text [message #29568 is a reply to message #29433] |
Tue, 26 February 2002 18:57  |
Thomas Launey
Messages: 25 Registered: September 1999
|
Junior Member |
|
|
Hi,
I had the same problem (5.3 and 5.4) on Win98 (but not NT or 2000). I
wanted to use the text widget as a buffer for cut and paste to Excel.
The work around was to chunk of the table.
I have not tried 5.5 on Win98 and I think that David is on Win2000.
I hope this helps
Thomas
Thomas Launey
Lab. for Memory and Learning, RIKEN, Japan
|
|
|