[Mono-list] Beginer's problem with button event

Francisco M. Marzoa fmmarzoa at gmx.net
Sun Nov 21 10:35:47 EST 2010


Hello,

I've problems to catch an event with a dinamically created button.
Involved code follows:

        btAccept = new Gtk.Button ( new Gtk.Label ("Accept"));
        btAccept.Events = Gdk.EventMask.AllEventsMask;
        btAccept.ButtonPressEvent += new ButtonPressEventHandler
(UpdateWidgetProperties);

...

public void UpdateWidgetProperties (object o, ButtonPressEventArgs args ) {
...
}

The problem is that when I press the button btAccept, the function
UpdateWidgetProperties is NOT called (I've even put a breakpoint within
it to confirm this point).

Sure I forgot some step, but I do not figure out what...

Anyway I've solved it using btAccept.Clicked instead ButtonPressEvent
and EventArgs instead of ButtonPressEventArgs, but I do not know why the
code showed here does not work as expected. :-?

Regards,








More information about the Mono-list mailing list