[Gtk-sharp-list] binding an event to GnomeDb.Grid in mono and using GList
Marius Andreiana
mandreiana@rdslink.ro
Sun, 30 Nov 2003 12:26:39 +0200
Hi
I'm trying to get a list of selected rows from GnomeDb.Grid in mono like
this:
db_grid.RowSelected += new EventHandler( on_db_grid_row_selected );
...
public void on_db_grid_row_selected(object o, EventArgs args)
{
GLib.List row_list;
row_list = db_grid.Selection;
Console.WriteLine( row_list.Count );
foreach( int i in row_list ) {
Console.WriteLine( i );
}
}
but on compile I get this error:
error CS0019: Operator + cannot be applied to operands of type
`GnomeDbSharp.RowSelectedHandler' and `System.EventHandler'
How to bind the signal?
Commenting the EventHandler line and calling the code in handler
separately, I get this error:
Unhandled Exception: System.NullReferenceException: A null value was
found where an object instance was required
in (unmanaged) (wrapper managed-to-native)
GLib.Object:gtksharp_is_object (intptr)
in <0x00004> (wrapper managed-to-native) GLib.Object:gtksharp_is_object
(intptr)in <0x0000d> GLib.Object:IsObject (intptr)
in <0x0011f> GLib.ListBase:DataMarshal (intptr)
in <0x00048> .ListEnumerator:get_Current ()
How to use it? Displaying the Count works.
I looked on GLib# api but it gives an example only for adding elements
to list, don't know how to get them back.
Thanks
--
Marius Andreiana
Galuna - Solutii Linux in Romania
http://www.galuna.ro