Re: [gtkmm] forcing a redraw



ok,

what I want is really your case (a):

void dis::gui::MainWindow::Start_Something ()
{       file_selector->hide();
analysis = new Analysis (&selected_filename, ts, &dc); ret_code = analysis->Perform();
}

'file_selector' is the dialog I am using to ask for a filename to perform an operation on; the operation is basically a long list of calculations that are managed in a separate thread. I want to achieve two elements:

- hide the file_selector at once, and not wait until the end of Start_Something... It even seems to me that the normal redraw awaits the end of the thread that was started up? Not much point in programmig a separate thread, then... I had already experimented with the queue_redraw, but that doesn't seem to change anything in the gui behaviour.

- periodically show new results from the calculations.

--> so I guess I have to use the while loop; but the 'Analysis' object for the moment doesn't #include any gtk headers, so the while loop doesn't compile there...

is there really no equivalent in gtkmm for the while loop?

thanks, Danny.

************************

On 2003.01.26 18:15 Paul Davis wrote:
I believe the function you want is simply

queue_draw();

while (gtk_events_pending())
      gtk_main_iteration();

?

I mean, how can I force the redraw of a window or widget?

there are two different situations:

  (a) you want to handle events and redraw widgets but not
        return control the "main event loop"

  (b) you want to force a redraw of a particular widget as
        soon as possible, but are happy to return control
	to the main event loop.

case (a) is handled by the while() loop. case (b) is handled by
queue_draw().

and no, i don't know of the direct gtkmm equivalent.

--p




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