[Gtk-sharp-list] gtk_tree_selection_get_selected_rows() custom
21 Feb 2003 17:52:22 -0500
On Thu, 2003-02-20 at 23:52, George Farris wrote:
> Well I'm stumped at the moment. I guess I'll leave multiple selection
> and move on, maybe someone with more programming knowledge than me will
> figure it out.
For what it's worth, I've got SelectedForeach to be useful in the following way...
Create your own GetAllSelected() function in a convenient place, (my class encapsulates a scrolled window and TreeView).
Have a member variable in your class that's an ArrayList called 'rows'.
Your GetAllSelected does something like:
public IList GetAllSelected()
TreeSelection selectionInfo = widget.Selection;
rows = new ArrayList();
Console.WriteLine("got " + rows.Count + " rows");
And the recordRow() function is something like this:
private void recordRow(Gtk.TreeModel model, Gtk.TreePath path, Gtk.TreeIter iter)
string listIndex = path.ToString();
// Optionally look up some data based on the fact that
// list index tells you which row is selected
Then when you call your GetAllSelected() function you have full control over what gets returned.
I realize it's far from a one-liner, but I think it gives you all the control you could want...
Hope that helps!
Lee Mallabone <email@example.com>