On Fri, May 29, 2009 at 9:20 AM, David Katz
<[email protected]>wrote:
> I'm trying to use an rGtkDataFrame to display data
>
and when the user selects
> a row to take some action. I attached a signal:
>
> treeSelection <- gtkTreeViewGetSelection(view)
>
> onSelectionChanged <-
> function(treeselection,user.obj){
> str(gtkTreeSelectionGetSelected(treeselection))
> }
>
> So how do I use the result to identify which row was selected?
>
One way, assuming you have a single selection mode, is to get the
GtkTreeIter of the selected row.
iter <- treeselection$getSelected()
Then get a GtkTreePath describing that GtkTreeIter, using the
GtkTreeModel/RGtkDataFrame:
path <- model$getPath(iter)
Then get the index of the row via:
row <- path$getIndices()
It's a lot of work, but it's a complex framework and RGtk2 is designed as a
low-level binding.
If you're indexing directly into the RGtkDataFrame, you could also do this:
model[treeselection$getSelectedRows()$retval,]
Which would subset the RGtkDataFrame for the selected rows.
Michael
>
> Thanks.
> --
> David Katz
>
> www.davidkatzconsulting.com
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-GUI mailing list
> [email protected]
> https://stat.ethz.ch/mailman/listinfo/r-sig-gui
>
[[alternative HTML version deleted]]
_______________________________________________
R-SIG-GUI mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-gui