Re: "Wait" window doesn't appear!
- From: Paul Davis <pbd op net>
- To: Germano Rizzo <mano pluto linux it>
- Cc: gtk-list gnome org
- Subject: Re: "Wait" window doesn't appear!
- Date: Wed, 16 Oct 2002 11:35:13 -0400
> I wrote the following code for a program of mine. It displays a "wait
>till it's done" window, execute some operations, then destroy it.
>
>[...]
>
>wait = gtk_window_new (GTK_WINDOW_TOPLEVEL);
>gtk_window_set_title (GTK_WINDOW (wait), _("Please wait..."));
>gtk_window_set_transient_for (GTK_WINDOW (wait), GTK_WINDOW (dlg));
>wlbl = gtk_label_new (_("Please wait, collecting data..."));
>gtk_container_set_border_width (GTK_CONTAINER (wait), 10);
>gtk_container_add (GTK_CONTAINER (wait), wlbl);
>
>gtk_widget_show_all (wait);
>
>len = lseek (fd, 0, SEEK_END);
>pwd = mmap (NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);
>key = grg_key_gen (pwd, len);
>munmap (pwd, len);
>close (fd);
>
>gtk_widget_destroy (wait);
>
>[...]
>
>The problem is, the window doesn't show. If the file pointed by fd is
>slow enough, i.e. a floppy, it spins the drive, reads data, processes
>it, all correctly, but the window isn't displayed. If I remove
>gtk_widget_destroy, it executes the loading and _then_ displays the
>window. What can I do?
read the archives, using a reasonable set of keywords to search by.
more helpfully, to have a GUI change the visual appearance of things,
you have to return control to it. calls like gtk_widget_show() merely
make *requests* to change the appearance - the redrawing (or window
creation, or whatever) doesn't happen till you return control to the
"insides" of the GUI itself. hence, add this after the "show_all":
while (gtk_events_pending()) {
gtk_main_iteration();
}
and that should do the right thing. this has only been mentioned here
at least 4 dozen times ... :)
--p
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]