Re: main window not redrawing after dialog closes
- From: Rob Benton <rob benton conwaycorp net>
- To: Emilian Nowak <emiml wp pl>
- Cc: gtkmm-list gnome org
- Subject: Re: main window not redrawing after dialog closes
- Date: Fri, 27 Jan 2006 17:41:52 -0600
Emilian Nowak wrote:
On 2006-01-25 (wed) Rob Benton wrote:
In my main window I open a filechooser dialog then close it, set the
mouse cursor to Gdk::WATCH, call a function, then change back the
cursor. The problem is after the dialog closes the main window does not
immediately redraw and the cursor does not immediately change. It's not
until my function is nearly finished that these things happen. What
could be my problem here? Maybe I'm not understanding the way X events
fit in with non-X operations.
I guess that probably this method causes gui-freezing.
_member_widget->read_from_xml(_filename);
// enable menu items
Every program should have different thread for non-gui operations especially
if it makes, a lot of computing/data processing.
Read about Glib::Thread
http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/classGlib_1_1Thread.html
and all other resources available on Internet about multi-threaded
applications.
Well I gave it a shot and got the exact same results. Do I have this in
the right? Now my code looks like this:
void MainWindow::menu_open()
{
// change cursor while working
get_window()->set_cursor(Gdk::Cursor(Gdk::WATCH));
_filename = Glib::filename_to_utf8(dialog.get_filename());
Glib::Thread * thread = Glib::Thread::create(
sigc::mem_fun(*this,&MainWindow::thread_open), true);
thread->join();
get_window()->set_cursor();
}
void MainWindow::thread_open()
{
_member_widget->read_from_xml(_filename);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]