[Gtk-sharp-list] Updating UI from a thread

Vincent Arnoux vincent.arnoux@rfo.atmel.com
Wed, 09 Mar 2005 10:00:18 +0100


Sorry I made a mistake in the code: I am using the "ThreadStart" class
to create the thread.
Doesn't anyone has a track for me to follow ?

Vincent
class myApp
{
   Label myLabel;

   public static void Main (string[] args)
   {
       new myApp ();
   }

   public myApp()
   {
      //build a Gtk# window an add a label called myLabel

      Thread oThread =3D new Thread(new ThreadStart(this.LongComputation)=
);
      oThread.IsBackground =3D true;
      oThread.Start();
   }

   public void LongComputation()
   {
      for (int i =3D 0; i < 100000000000000; i++)
         myLabel.Text =3D "#" + i;
   }
}

Vincent Arnoux a =E9crit :

> Hello,
> I start a large computation in a thread of my program, and I want this=20
> thread to update a label. I know this looks like a classical issue,=20
> but I can't find an easy solution. Can you please give me a solution,=20
> or point me towards a link ?
>
> ...
>
> Regards,
> Vincent
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
>
>