Re: dialogs problems



Most things that you do in Gtk are only done when
your code is finished (ie. in the main loop.). so
when you do "gtk_widget_destroy()" the screen will
only be updated when your callback returns. For the
cleanest results try to never hijack the main loop.
for quick fixes use:

while (gtk_events_pending())
        gtk_main_iteration();

but I find its usualy cleaner to use short operations.
example: I'm doing a long query to a mysql database
and I want to update a progress bar. I tell mysql to 
return every 10 results and iterate through my queries
with a timeout source in the main loop rather than:

while(not_finished) {
        query;
        update_ui;
}

Cheers,
        -Tristan


Emmanuel Saracco wrote:

1/ when I close a window through gtk_widget_destroy() and when I start,
right after, a treatment that eat a lot of resources, the ok button
remains pushed and the window will close only when the treatment ends
on. obviously the best would be that it closes just before the treatment
starts.

2/ when the treatment is getting on I would like to be able to show the
user a progress window to inform him from the progressions. the problem
is that the window that I open *before* the treatment is being shown
just after.

I use gtk2.

any idea?

bye
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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