I am experimenting a bit with monodevelop/c#/gdk and I was able to create a window with a DrawingArea
correctly handling the expose event.
The mouse down events however are not dispatched and I don't understand why. The delegates have been set up in the code autogenerated by the gui designer:
this.da.ExposeEvent += new global::Gtk.ExposeEventHandler (this.OnDAExposeEvent);
this.da.ButtonPressEvent += new global::Gtk.ButtonPressEventHandler (this.OnDAButtonPressEvent);
this.da.MotionNotifyEvent += new global::Gtk.MotionNotifyEventHandler (this.OnDAMotionNotifyEvent);
and this is my initialization code:
public MainWindow () : base (Gtk.WindowType.Toplevel)
{
Build ();
Gdk.Color col = new Gdk.Color();
col.Red = col.Green = col.Blue = 0x8888;
da.ModifyBg(StateType.Normal, col);
var p = "wr/wn/wb/wq/wk/wp/br/bn/bb/bq/bk/bp".Split ('/');
for (int i = 0; i < p.Length; i++) {
pieces[p[i]] = new ImageSurface("/home/agriffini/x/chessboard/i" + p [i] + ".png");
}
da.Events |= (Gdk.EventMask.ButtonPressMask
| Gdk.EventMask.ButtonReleaseMask
| Gdk.EventMask.KeyPressMask
| Gdk.EventMask.PointerMotionMask);
}
however the handler function OnDAButtonPressEvent
never gets called (checked by placing a breakpoint there).
What is the part that is missing?