Re: How to update the interface?



Thanks for the replies. I took a look at the docs today. It's mentioned there that I can use gdk_threads_enter() / gdk_threads_leave() + gdk_flush() commands. The first enter and leave pair should be used when you want to make a function call and wrap that function with these commands. I tried that first in my application. It worked in some small function calls and didn't work out for long functions that have long process time. Inside the functions, I used the gdk_flush() to update the labels or textview widget, however it didn't work out. Nothing is updated in the interface. You also suggested me to use threads. My question at that point is, say if I had a lot of parameters to pass to that function or thread, what would I do in that case? How can I update the interface members inside that thread then?

Isn't there a simple way to block the running process outside of the interface thread, update the interface members or elements, then continue the process?



From: Paul Davis <pjdavis engineering uiowa edu>
To: MERT TUGCU <merttugcu hotmail com>
CC: gtkmm-list gnome org
Subject: Re: How to update the interface?
Date: Thu, 13 Oct 2005 02:01:05 -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,


_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list

There are conflicting opinions on how exactly to update the UI and process some method at the same time. I say use threads. Others said process the method and periodically clear the event queue for the UI. I say use threads.

As for the textview, take a look at the docs. Its something like textview->get_buffer()->set_text( string text ) ;

Cheers,
Paul





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