[comp.windows.x.motif] Putting large amount of text into scrolled text widget takes FOREVER

cont1@tse.uucp (Contractor #1 = Tim Horton) (12/14/90)

Inserting large amounts of text (a few hundred lines) into a text widget
takes forever, because the widget resizes itself once for each line of
text in the data as it goes through it, and, since I have the widget in
a scroll window, the scrollbars get reconfigured and redrawn *each time*.
So to insert 400 lines of text takes from 30 seconds to a minute, (at 5-10
lines/blinks per second).  What am I doing wrong?

I only want to use the XmText widget to ouput (selectable) text.  I know
I can display the text to the user in no time flat, with a drawing area
widget, but then I loose the selection mechanism.

I'm using Motif 1.0 under SCO.   I use XtSetValues on XmNvalue to replace
the text.

THANKS!

uunet!jtsv16!geac!tse!cont1
(not always reliable)
   or
tjhorton@cs.toronto.edu
(whichever is simpler for you)

argv@turnpike.Eng.Sun.COM (Dan Heller) (12/27/90)

In article <1990Dec13.172420.28263@tse.uucp> cont1@tse.UUCP (Contractor #1 = Tim Horton) writes:
> Inserting large amounts of text (a few hundred lines) into a text widget
> takes forever, because the widget resizes itself once for each line of
> text in the data as it goes through it,

Don't add each line one-by-one.  Concatenate all the lines into one very long
string (yes, there should be embedded newline characters) and then set the
XmNvalue to that string.  Just to nit-pick: if all you're setting is XmNvalue,
use XmTextSetString instead to avoid the Set-Values method and having to go
thru Xt.

Also, since you're using SCO UNIX, don't forget to compile with -lmalloc
or performance will always be sluggish.
--
dan
----------------------------------------------------
O'Reilly && Associates   argv@sun.com / argv@ora.com
Opinions expressed reflect those of the author only.

phil@inetg1.Arco.Com (Phil Meyer) (12/27/90)

In article <5029@exodus.Eng.Sun.COM>, argv@turnpike.Eng.Sun.COM (Dan Heller) writes:
> 
> ... (yes, there should be embedded newline characters) and then set the
> XmNvalue to that string.

Speeking of newlines in these strings, (can't you guess?) How does one force
Text widgets to imbed newlines when it word wraps.  Or is this even desirable?
I can think of cases where output fonts don't match the input fonts, and 
therefore, you may not want imbedded newlines.
But couldn't this at least be an option?
--- 
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
| Phil Meyer         phil@arco.com  Work:(214) 754-6805                      |
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+