Re: How to update the interface?



On Thu, 13 Oct 2005 01:45:59 -0500, MERT TUGCU wrote:

> Hi everyone,
> 
> 
> 
> In my interface, I have button that is used to process an image. Since the 
> process takes some time, the button is either left pressed, does not pop 
> back during process or nothing happens. Is there any way to finish updating 
> the interface first then finishing the call to a function? Also I have a 
> textview widget I use in my application to show the user what steps are 
> taken during the process. During the process, it doesn?t update (or print 
> the text buffer) the textview widget also. Lastly, I would like to use the 
> textview widget pretty much like a terminal. For example, how can I do like: 
> textview_object << ?string? << an integer << an stl vector << endl; so that 
> I can print my stl vector variables or integers etc.
> 
> Thank you for your response in advance,


Use threads. 

When the button is clicked, spawn a new thread which does the image
processing. Then the gui thread (main thread) will be free to update the
display as it normally does. 

Using threads is non trivial. But then, nothing is. It may take a while to
get it right, particularly if you need to draw onto the GUI from your
image processing thread. There's synchronization issues. Take a look at

http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/group__Threads.html

(the Threads link under the glibmm documentation from the gtkmm
docs page).






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