Widget Updates



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




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