Hello, I'm writing a small application that makes a simple operation
(i.e. 5+6, 8*9, etc.) and the user gives the amount of time (seconds)
that operation will take, i.e. if the user enters 8 seconds my
application will enter in a little loop to wait 8 seconds.
The "wait" function works well, what happens is that the progress bar
gets updated only after the control exits the function and is at 100%
and the progress as the job is being done won't be displayed. I only see
the progress bar at 100% when it has finished the work and not during
the time it's being done.
I searched a little about this before sending this e-mail, I found I
should use the static functions in Gtk::Main::events_pending() and
Gtk::Main::iteration(), I saw a "false" argument should be passed to the
Gtk::Main::iteration() method, I tried both arguments (true and false)
none of them worked....
Here is part of the code I use
void wait(double seconds){
clock_t end_wait;
end_wait = clock () + end_wait * CLOCKS_PER_SEC ;
while (clock() < end_wait) {}
}
for(int i=1; i<=max_time; i++){
wait(1); //Waits one second
myProgressBar.set_fraction(i/max_time); //it updates the
GUI until it has returned to the main window loop
while(Gtk::Main::events_pending()) //this should update
the progress bar in GUI on each iteration in this for statement, but it
doesn't
Gtk::Main::iteration();//I tried both arguments, false
and true, none of them worked, same result... it gets updated when it
exits the function that uses this for statement
}
Thanks for your time and help.
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list