[Mono-list] glade signal connections

Iain McCoy iain@mccoy.id.au
Tue, 31 Aug 2004 20:46:52 +1000


On Tue, 2004-08-31 at 18:38, Rob Brown-Bayliss wrote:
> On Tue, 2004-08-31 at 16:51, Peter Williams wrote:
> > Do you just mean that you want to manually connect to a signal? Gtk#
> > wraps signals as events and you can treat them pretty much as you
would
> > any other event:
> > 
> >     Gtk.Window window = whatever ();
> >     window.DestroyEvent += new DestroyEventHandler (myfunction);
> 
> If I do this:
> 
> tree_view.RowActivated += new EventHandler (row_activated);
This is almost what you want.
> 
> I get this error:
> 
> Operator + cannot be applied to operands of type
> `Gtk.RowActivatedHandler' and `System.EventHandler'(CS0019)
> 
This is telling you that you can only add delegates of type
Gtk.RowActivatedHandler to this event. Try this:
tree_view.RowActivated += new RowActivatedHandler (row_activated);

I think this will force you to change the prototype of row_activated to
match the RowActivatedHandler prototype. If you can't/won't run monodoc,
the monop tool is often handy:
$ monop -r:$MONO_PREFIX/lib/mono/gtk-sharp/gtk-sharp.dll
Gtk.RowActivatedHandler
[Serializable]
public delegate void RowActivatedHandler (object o, Gtk.RowActivatedArgs
args);
$ exit

I think my mailer's going to word wrap there, but [Serializable] is the
first line of output. Everything before that is the monop invocation.
$MONO_PREFIX is probably either /usr or /usr/local, depending on how you
installed.

<other stuff snipped>
-- 
Iain McCoy <iain@mccoy.id.au>