question about gtk_events_pending() and gtk_main_iteration()
- From: "Sergey I. Kuzminov" <ksi sparc spb su>
- To: gtk-list gnome org
- Subject: question about gtk_events_pending() and gtk_main_iteration()
- Date: Mon, 17 Dec 2001 17:31:21 +0300
Hi !
I have one question about loop:
while (gtk_events_pending())
gtk_main_iteration();
Documenation says what gtk_events_pending() method can be used to update the
GUI.
I want to see toplevel window with my widget (for example, GtkSpinButton).
If I invoke g_usleep (1) during the loop I can see correct shown window and
button.
But if I comment this string, usually I can't see button.
Why ?
Thanks,
Sergey
-------------------------------
#include <gtk/gtk.h>
int
main (int argc, char** argv)
{
GtkWidget* window;
GtkWidget* button;
gint i;
gtk_init (&argc, &argv);
for (i = 0; i < 10; i++)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
button = gtk_spin_button_new_with_range (0, 10, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (button), i);
gtk_container_add (GTK_CONTAINER (window), button);
gtk_container_set_border_width (GTK_CONTAINER (window), 30);
gtk_widget_show_all (window);
while (gtk_events_pending())
{
// g_usleep (1);
gtk_main_iteration();
}
g_usleep (1000000);
gtk_widget_destroy (window);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]