Re: Application redrawing
- From: "A B" <alvinbeach hotmail com>
- To: gtk-app-devel-list gnome org
- Subject: Re: Application redrawing
- Date: Tue, 08 Apr 2003 17:35:05 -0400
Thank you. I have tried Option 2 but for some reason when I set the
GtkProgress with gtk_progress_bar_set_fraction() it does not redraw.
However, if I use gtk_progress_bar_pulse() it does redraw. Is there a reason
for this?
I will try the 'pipes' method and see if that is better for me.
Thank you,
-------
Alvin Beach
Email: alvinbeach hotmail com
Website: http://www.vianet.ca/~abeach
From: Roland Smith <rsmith xs4all nl>
Reply-To: rsmith xs4all nl
To: gtk-app-devel-list gnome org
Subject: Re: Application redrawing
Date: Tue, 8 Apr 2003 19:44:31 +0200
On Sun, 06 Apr 2003 16:53:41 -0400
"A B" <alvinbeach hotmail com> wrote:
> Hello,
>
> I am experimenting with GTK+. I am creating an app that does a lot of
> processing. What I am having problems with is having the application
redraw
> itself. I thought that if I put all the processing in a pthread that
would
> help. But, this isn't the case.
>
> What do GTK+ programmers do to work around this?
There are a couple of alternatives. Using threads is one of them (but not
the
best IMHO). GTK+ depends on a regular flow of events. That means you
should:
1 - split you calculation in little pieces that can be invoked via timeouts
or
idle functions.
2 - allow GTK+ to process events from within your calculation
3 - use a separate calculation program, that communicates with the GUI via
pipes
4 - use threads. But do not issue gTK+ calls from the thread that does the
processing.
For 1 see gtk_timeout_add() and gtk_idle_add().
for 2 use something like:
/* computation going on */
while (gtk_events_pending ())
gtk_main_iteration ();
/* computation continued */
For 3 see g_spawn_async_with_pipes()
Roland
--
R.F. Smith /"\ ASCII Ribbon Campaign
r s m i t h @ x s 4 a l l . n l \ / No HTML/RTF in email
http://www.xs4all.nl/~rsmith/ X No Word docs in email
/ \ Respect for open standards
<< attach3 >>
_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]