Re: About Treeview update with thread




On May 8, 2009, at 10:51 PM, åçå wrote:

hi,
In my project, The GUI have a treeview and a 'Run' Button,Treestore may have thourands of datas.

When i click the 'Run' button, the logci will process the treestore datas one by one(this is a long time procedure), when one data process complete, i need to update the Treeview immediately.

In order to avoid the GUI lag, I use a thread to do the backend processing. The problem is when the thread to update the Treeview, the logic will fail.


- Remember to grab and release the gdk lock around the gui accesses from the other thread, or

- Instead of immediately modifying the treemodel in your background thread, install a single-shot idle that will do it. This effectively defers the work to the main thread so that only one thread touches the ui.




--
Sallah!  I said no camels!  That's five camels!  Can't you count?
  -- Indiana Jones




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