[Gtk-sharp-list] Changed Event

Christian Hoff christian_hoff at gmx.net
Sat Dec 6 07:11:44 EST 2008


Hey,

first your way of connecting to the "Changed" event seems to be very 
strange. Why don't you use
if (widget is Gtk.Editable) {
    (widget as Gtk.Editable).Changed += this.OnWidgetChanged ;
}?

if that doesn't help, try applying the [GLib.ConnectBeforeAttribute] to 
the OnWidgetChanged method; see 
http://gtk-sharp.sourceforge.net/faq.html#3.3 (but that doesn't seem to 
be the reason in this case).

Christian

Wolfgang Mauer schrieb:
> Hi all,
> i try'd to bind a Method("OnWidgetChanged") to the "Changed"-Event of some 
> Widgets but like this the event never raised.
> Any Help?
>
> 	EventInfo eInfo = this.widget.GetType().GetEvent("Changed");
> 	if (eInfo != null)
> 	{
> 		MethodInfo mi = this.GetType().GetMethod("OnWidgetChanged", 
> BindingFlags.Instance | BindingFlags.NonPublic);
> 		if (mi != null)
> 		{
> 			Delegate del = Delegate.CreateDelegate(eInfo.EventHandlerType, this, mi);
> 			if (del != null)
> 			{
> 				eInfo.AddEventHandler(this.widget, del);
> 			}
> 		}
> 	}
> ......
>
> void OnWidgetChanged(object sender, EventArgs e)
> {
> }
>   


More information about the Gtk-sharp-list mailing list