开发者

Why does my GtkTreeView update fire only after the gtkitem event finishes?

开发者 https://www.devze.com 2023-04-06 03:48 出处:网络
I have a gtktree with columns and values. I also have a popupmenu with one gtkmenuitem: \'Refresh\'.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号