[Gtk-sharp-list] Updating of a window not done right away
Pedro Guridi
pipiten at gmail.com
Wed Sep 24 13:03:06 EDT 2008
Hi,
If you want to update the gui, and receive events during a loop, try adding
this inside the "for":
while (Gtk.Application.EventsPending ())
Gtk.Application.RunIteration ();
and if not necessary, comment "Thread.Sleep(3000);".
regards,
Pedro
On Wed, Sep 24, 2008 at 5:52 AM, Mathias Tausig <mtausig at fsmat.at> wrote:
> Am 23. Sep 2008 um 23:43:04 -0400, schrieb Michael Hutchinson:
> > On Tue, Sep 23, 2008 at 4:51 AM, Mathias Tausig <mtausig at fsmat.at>
> wrote:
> > > Hy!
> > >
> > > I wrote a class DisplayPanel (see below., which should just display
> some text right away. The problem is, it just doesn't do that if I start
> some blocking function after setting the text. If I execute
> > >
> > > Gtk.Window w = new Gtk.Window("Test");
> > > w.Show();
> > > for(int i=0;i<20;++i){
> > > DisplayPanel dp = new DisplayPanel("",w);
> > > dp.SetTitle(i);
> > > Thread.Sleep(3000);
> > > dp.Dispose();
> > > }
> > >
> > > sometimes it does display the correct text right away, but sometimes
> (rather unpredictable, about every third time) I get just an empty Window.
> > > Does anyone have an idea, what might cause this?
> >
> > You're blocking the main loop. The main GTK loop handles repainting,
> > firing events, etc.
>
> I know. But in my class, when calling SetTitle, I have a loop that executes
> RunIteration as foten as neccesary which, as far as I have understood the
> loop, should do all the update, as it is executed before the blocking call.
>
> cheers
> Mathias
> _______________________________________________
> Gtk-sharp-list maillist - Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20080924/2094889f/attachment.html
More information about the Gtk-sharp-list
mailing list