Re: Widget Updates




  If you are using threads, you might want to take a look at GTK and threads
FAQs. It is on the GTK site (www.gtk.org). Look for gtk_threads_enter() and
gtk_threads_leave().

  The other thing I see there is:
  "str_val[0] = something() + '0';"

   It does not look like it is something that you want to do. Maybe a strcpy ?

   The other thing is that you can used a single thread program and register
the fuction to be called ( gtk_timeout_add() or If using GTK2.0 , take a look
at IOChanel)

 Hope this help.

  

  
--- Francisco Sant'Anna <chico santanna uol com br> wrote:
Hello,

I have several labels that should have their text properties updated by
a thread every second.

The simplified thread code is below:

while (1)
{
        for (i=1; i<=TOTAL_BITS; i++)
        {
                str_val[0] = bit_value(i) + '0';
                gtk_label_set_text(GTK_LABEL(gui_pins[i]), str_val);
                printf("%s | ", str_val);
        }
        printf("\r");
        fflush(stdout);
        sleep(1);
}

The printf() part is working as expected, but the gtk_label_set_text()
is not.

The labels sometimes gets updated, sometimes not.

Reading the archives I saw something that I should use like:

while (g_main_iteration(FALSE));

Sorry, but I have no knowlodge in GUI programming, so I have no idea
where and why this line should be used.

If you could, please:

1: Give me a simple workaround to make that work.
2: A simple explanation of what is going on and references to implement
it right in a near future.

Thank you very much for any answer.

And thank you for a very nice GUI API in pure C.

-- 
-chico

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


__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com



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