[Gtk-sharp-list] TreeSelection Critical Warnings

Gonzalo Paniagua Javier gonzalo@ximian.com
Mon, 20 Oct 2003 09:37:08 +0200


El dom, 19-10-2003 a las 23:39, Daniel Morgan escribió:
> 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.

I do this in gnunit:

	TreeSelection selection = assemblyView.Selection;
	TreeModel model;
	TreeIter iter = new TreeIter ();

	if (!selection.GetSelected (out model, ref iter)) {
		appbar.SetStatus ("You have to select a test to run."));
		return;
	}

-Gonzalo