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

Vincent Arnoux vincent.arnoux@rfo.atmel.com
Wed, 09 Mar 2005 15:25:51 +0100


This is _exactly_ what I was looking for !
Thanks a lot to have answered my SOS.

Vincent

Antonio Guti=E9rrez Mayoral a =E9crit :

>Hello,
>
>See Gtk.ThreadNotify Class on Monodoc manual, it includes an example.
>
>Saludos,
>
>Antonio
>
>El mi=E9, 09-03-2005 a las 10:00 +0100, Vincent Arnoux escribi=F3:
> =20
>
>>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.LongComputatio=
n));
>>      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 :
>>
>>   =20
>>
>>>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
>>>
>>>
>>>
>>>     =20
>>>
>>
>>_______________________________________________
>>Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
>>http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>>   =20
>>