[prev in list] [next in list] [prev in thread] [next in thread]
List: gtkmm
Subject: Re: main window not redrawing after dialog closes
From: Rob Benton <rob.benton () conwaycorp ! net>
Date: 2006-01-28 19:51:54
Message-ID: 43DBD138.6070705 () conwaycorp ! net
[Download RAW message or body]
Paul Davis wrote:
> you need to get your mind wrapped around the idea that you've created a
> thread that will finish what its doing at some point in the future, but
> you do not know when. until it finishes, you want to return control to
> the regular event loop. here is a hint at one way to do this, not
> bombproof, but you will get the idea:
>
> bool xml_thread_running; // global or object scope
>
> ....
>
> xml_thread_running = true;
> Glib::Thread * thread = Glib::Thread::create(
> sigc::mem_fun(*this,&MainWindow::thread_open), true);
>
> while (xml_thread_running) {
> if (Gtk::Main::events_pending()) {
> Gtk::Main::iteration ();
> }
> }
>
> get_window()->set_cursor ();
>
>
>>void MainWindow::thread_open()
>>{
>> _member_widget->read_from_xml(_filename);
>
> xml_thread_running = false;
>
>>}
Now my eyes are opened. Thanks Paul. I never thought to look at the
Gtk::Main object. One more question though. In the case that I have,
my member function reads from an xml file then updates a table of
Gdk::Drawables on-screen. Is it ok to have that whole member function
threaded or should I do the threading there just around the actual
xml-reading part?
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic