[Gtk-sharp-list] [NewBie] Gtk.Main Thread Notification

Antonio Martínez Álvarez amartinez@atc.ugr.es
Mon, 15 Mar 2004 21:58:13 +0100

El lun, 15-03-2004 a las 18:01, Alessandro Lendaro escribió:
> Thanx to everybody for your advice, but please, is someone aple to post 
> a little exemple on how to use
> the Idle Class and how it works?

This code is inside a method which is executed by a thread:

GLib.Idle.Add(new IdleHandler(this.myIdleHandler));

and here you are the template for the method myIdleHandler:

 bool myIdleHandler() {
   // Write here your Gtk# stuff
   return false;

This works for me in Linux and Windows withow problems. I don't use
Gdk.Threads.Init(), Gdk.Threads.Enter() and Gdk.Threads.Leave(). I'm not
an expert, I don't know if this is the best way to solve it.

Antonio Martínez Álvarez
amartinez at atc.ugr.es