Re: Window (CList) update semantics



The window doesn't update until the handler returns. 

Perl is not multi-threaded (at least not by default).  This means that
nothing can happen until the handler returns or you code for it to
happen.  I have found that saying

Gtk->main_iteration while Gtk->event_pending;

solves this sort of problem.

Thanks! I'm now using Gtk-> main_iteration_do (0) within the
routine that needs the screen update done; with a bunch of 
functinos queued up it seems to flush them all OK.

sub update_cell {
my ($widget, $row, $col, $msg)= @_;

        $widget-> select_row ($row, $col);              # select the row,
        $widget-> moveto ($row, 0, 0.5, 0.0);           # center the list row,
        $widget-> freeze;
        $widget-> set_text ($row, $col, $msg);          # new text,
        $widget-> thaw;
        Gtk-> main_iteration_do (0);                    # allow update now.
}


I'd bet under the circumstances the freeze/thaw aren't required,
but they don't hurt.

Thanks again (and thanks Muppet also).

tomj





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