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

Paulo Pires paulo.pires@vodafone.pt
Tue, 08 Mar 2005 22:10:11 +0000


Hi

Take a look at Gtk.ThreadNotify


Paulo Pires

Ter, 2005-03-08 =E0s 20:33 +0100, Vincent Arnoux escreveu:
>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, but=20
>I can't find an easy solution. Can you please give me a solution, or=20
>point me towards a link ?
>
>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(this.LongComputation);
>       oThread.IsBackground =3D true;
>       oThread.Start();
>    }
>
>    public void LongComputation()
>    {
>       for (int i =3D 0; i < 100000000000000; i++)
>          myLabel.Text =3D "#" + i;
>    }
>}
>
>Regards,
>Vincent
>_______________________________________________
>Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/gtk-sharp-list