[Gtk-sharp-list] Updating of a window not done right away
Mathias Tausig
mtausig at fsmat.at
Fri Sep 26 03:31:55 EDT 2008
Am 25. Sep 2008 um 08:14:03 -0400, schrieb Adam Tauno Williams:
> On Thu, 2008-09-25 at 09:49 +0200, Mathias Tausig wrote:
> > Am 24. Sep 2008 um 16:50:02 -0300, schrieb Pedro Guridi:
> > > I'm not sure if we are talking about the same thing.
> > > But what I'm saying, it's for the case when you have a long operation, or
> > > some long while/for, and because of that the gtk main loop will
> > > not be able to update the gui, or receive any event until the loop ends.
> > > To solve that you can add this inside the blocking loop (assuming that
> > > runs in the main thread than Gtk, that's the point after all) :
> > > while (Gtk.Application.EventsPending ())
> > > Gtk.Application.RunIteration ();
> > Look at my code snippet in my inititial mail. That's exaclty what I am doing in my DisplayPanel class, whenever I change the text. That's why I consider this behaviour to be so weird
> > > Question.., I guess you are using these: "Thread.Sleep(3000)" for giving
> > > the gtk main thread a time to update the gui, I'm right?.
> > > if this is the case, try putting the code above instead of the
> > > "Thread.Sleep(3000);".
> > The Thread.Sleep only exists in this short example function. In reality, a longish and blocking function (a pinpad verification of a smartcard) is executed.
>
> I haven't looked at the code in question, but rather than messing with
> the loop wouldn't it be easier to put the pinpad verification into a
> background thread and notify the main thread when success/failure
> occurs?
Maybe this would work. But I actually do want to understand, what the problem is here.
cheers
Mathias
More information about the Gtk-sharp-list
mailing list