Re: Problem forcing display of text



Thank you for your reply.

The text is not updated frequently.  About 20 short lines are output as the I/O task is initialized, 3 or 4 more lines once a survey has been completed, then nothing until the time consuming I/O work is done.  The main thread should have lots of idle time, the I/O thread is very busy.

I'm looking for a way to flush from the main thread.

Mickey.

>From: "Gustavo J. A. M. "Carneiro
>To: Mickey Houck
>CC: gtk-app-devel-list gnome org
>Subject: Re: Problem forcing display of text
>Date: 24 Jan 2003 17:16:15 +0000
>
> I think that what may be happening is that you are inserting text too
>frequently. GtkTextView updates itself in an idle function. If the gtk
>main loop has no idle time, the text view updates will never happen.
>
> I suggest you update less frequently. Instead of inserting many small
>chunks of text, append to a text buffer (GString). Every once in a while
>(half a second, perhaps), flush the buffer into the text widget.
>
>On Fri, 2003-01-24 at 13:23, Mickey Houck wrote:
> > I'm writing an application collects inputs, then reads a lot of data.
> > As the data is being read, I have a dialog that contains a progress
> > bar (showing percent complete), and a text widget to display runtime
> > messages.
> >
> > I'm using pthreads. The code that reads all the data is started as a
> > separate thread. This thread (the I/O thread) is doing the
> > gtk_text_buffer_insert calls to show the runtime messages. The
> > progress bar is being updated with a timeout function back in the main
> > thread based on data updated in the I/O thread.
> >
> > No problem with the progress bar and I'm confident that the thread
> > code is implemented correctly.
> >
> > I can't seem to force the data in the text buffer to be displayed in
> > the text widget as it is inserted. It's there, I just can't see it
> > right away.
> >
> > Moving the mouse in and out of the window displays some text, but it
> > takes a click in the text widget to get everything displayed once the
> > I/O thread is done. I don't want to force the user to do any silly
> > stuff like that.
> >
> > Updating the text widget from the timeout does not help - still
> > requires the window focus change or click to display the text.
> >
> > It seems like I could send an expose-event or something from the
> > timeout function to refresh the text widget, but I can't figure out
> > how to do it.
> >
> > I'm kinda new to gtk. Thanks in advance for any help.
> >
> > Mickey.
> >
> >
> >
> > ______________________________________________________________________
> > MSN 8 helps ELIMINATE E-MAIL VIRUSES. Get 2 months FREE*.
> > _______________________________________________ gtk-app-devel-list
> > mailing list gtk-app-devel-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>--
>Gustavo João Alves Marques Carneiro
>


The new MSN 8: smart spam protection and 2 months FREE*

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]