Re: Why can't I update the content of GtkLabel



enjoy70 163 net writes:

Hi,

In function processwindow() I created the GtkLabel label and it's parent window, and set it's content like 
"Now let's begin"
In another function do(), I use:
    gtk_label_set(GTK_LABEL(label), "Please wait...");
    gtk_widget_draw(label, NULL);
    ......
to make label changed by the program process.

But the label hasn't been updated until function do() returned, and only the last content was displayed.

The screen is only updated when the main loop is running.  You can force
it by doing the following:

do 
  {
    gtk_label_set (label, "some string");
    while (gtk_events_pending ())
      gtk_main_iteration ();
  }
while ();
etc.

Thanks,
-Jonathan




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