Re: [gtk-list] RE: GtkProgressBar && RE: updating a progress bar in a loop
- From: Chris Black <cblack wilma ifas ufl edu>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] RE: GtkProgressBar && RE: updating a progress bar in a loop
- Date: Thu, 05 Mar 1998 12:10:52 -0500
> On 05-Mar-98 Chris Black wrote:
> > I run gtk_init, create the progress bar, add a timeout that starts
> > my
> > loop, within the loop I call gtk_progress_bar_update but the
> > display doesn't
> > seem to change.
>
> Drawing updates usually only happen when you are in gtk_main. You can
> force them, however using something like:
>
> while (gtk_events_pending())
> gtk_main_iteration();
>
> inside you're respective functions that change the progress bar.
Hmm, but since I call the loop from inside the timeout, shouldn't that
be in gtk_main? I thought the timeouts only start happening after gtk_main is
entered. My flow is sorta like:
/* global vars */
GtkWidget *pbar;
int main(int argc, char *argv[]) {
/* setup vars and such here, including the struct for request */
gtk_init(&argc, &argv);
pbar = create_progress_bar();
gtk_timeout_add(100, (GtkFunction) progress_timeout, request);
gtk_main();
return 0;
}
and progress_timeout looks like:
gint progress_timeout (gpointer data) {
goloopy(data);
printf("I did some stuff\n");
return FALSE;
}
and goloopy looks like:
int goloopy(req_struct *req) {
/* setup stuff */
/* more setup stuff */
while(var) {
/* do some loop stuff */
gtk_progress_bar_update
(GTK_PROGRESS_BAR (pbar), (gfloat) percent);
if(somecond) { var = 0; }
}
return 0;
}
of course, this is just an outline.
Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]