Why does my GtkTreeView update fire only after the gtkitem event finishes?
I have a gtktree with columns and values. I also have a popupmenu with one gtkmenuitem: 'Refresh'.
The refresh event does two things:
- repopulate my gtktree
- preforms a query.
The query is not immediate, it takes about 5 seconds. Why I can see the update of the tree only after the 5 seconds of the query? I want an immediate u开发者_开发技巧pdate of the gtktree, I don't understand the delay of the update.
If you are doing a long computation, then the program is busy with that and doesn't have time to update the GUI. To solve this problem, make sure that you execute the following code in the "main loop" of your query (if it has such a thing):
while(gtk_events_pending())
gtk_main_iteration();
If your query doesn't have a loop, for example if it runs completely in an external library, you will have to do as Will suggests and run it in a separate thread.
精彩评论