GTK in C - How to update a label from within a function
I'm struggling with something that seems trivially simple (please don't laugh).
I have a button whose callback function looks like this: Code:
void function() { How can I update the label (or perhaps "refresh" the window that the label is a part of) before "other stuff" happens? |
|
Thank you for your reply. Unfortunately, calling gtk_widget_show() doesn't seem to make a difference, at least not in my case.
I'm thinking that although functions like gtk_label_set_text() and gtk_widget_show() modify some internal values of the widgets, the actual redrawing (from the user's perspective) doesn't happen until the callback function terminates. I thought I could get around this by assigning two callback functions to the same widget, one for handling the label and one for handling the other stuff, but unfortunately it had the same result (the widget didn't get redrawn until both functions terminated). Just to be clear, my desired sequence is: 1. User interacts with widget (clicks a button in this case) 2. Label changes 3. Other stuff happens It seems that no matter what I do, 2 and 3 always happen out of order from the user's perspective... :cry: |
try
Code:
while(gtk_events_pending()) |
Yes, that did the trick. :)
|
All times are GMT -5. The time now is 12:19 AM. |