[Gtk-sharp-list] TreeSelection Critical Warnings

Daniel Morgan danielmorgan@verizon.net
Sun, 19 Oct 2003 17:39:52 -0400


Is thee a certain value returned by TreeSelection when nothing is selected,
such as, -1.  If so, then pop up a message that says "Hey You! Select a row
before doing something with it!".

If not, then I don't know.  My best guess would be like you said -
automatically set the first row in the TreeView.  I do this with many
applications that use a TreeView or some grid of data - I automatically set
the grid - it is what the user expects.

-----Original Message-----
From: gtk-sharp-list-admin@lists.ximian.com
[mailto:gtk-sharp-list-admin@lists.ximian.com]On Behalf Of Pablo Fischer
Sent: Saturday, October 18, 2003 3:34 PM
To: gtk-sharp-list@lists.ximian.com
Subject: [Gtk-sharp-list] TreeSelection Critical Warnings


Hi!

I have a treeview with some data, however If I dont select a row and try
to do something with it the application crases returning a
NullReferenceValue, so I found 2 options, but I don't know how to do
this in gtksharp (I think it's something related with TreeSelection)

1. Every time the treeview appears, select by default a row (the first
one).
2. Im trying for now with an Exception (and it works), but the output
is:

(<unknown>:2091): Gtk-CRITICAL **: file gtktreestore.c: line 568
(gtk_tree_store_get_path): assertion `iter->user_data != NULL' failed

(<unknown>:2091): Gtk-CRITICAL **: file gtktreestore.c: line 635
(gtk_tree_store_get_value): assertion `iter->stamp == GTK_TREE_STORE
(tree_model)->stamp' failed

(<unknown>:2091): GLib-GObject-CRITICAL **: file gvaluetypes.c: line 778
(g_value_get_string): assertion `G_VALUE_HOLDS_STRING (value)' failed

How I'm 'catching' it?, with this code:

    try {
      LoadAccountInfoWindow(Convert.ToInt32((string)value));
    } catch(System.NullReferenceException ex) {
      Console.WriteLine("Go away..");
    }

Thanks!
Pablo
--
Pablo Fischer Sandoval (pablo [arroba/at] pablo.com.mx)
http://www.pablo.com.mx
http://www.debianmexico.org
GPG FingerTip: 3D49 4CB8 8951 F2CA 8131 AF7C D1B9 1FB9 6B11 810C
Firma URL: http://www.pablo.com.mx/firmagpg.txt

_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list