Skip to content

Commit

Permalink
find out which row in a tree view is currently selected
Browse files Browse the repository at this point in the history
  • Loading branch information
OlafMerkert committed Oct 3, 2012
1 parent 7600e41 commit 41fd636
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages.lisp
Expand Up @@ -17,4 +17,5 @@
:define-custom-store :define-custom-store
:make-store :make-store
:setup-tree-view :setup-tree-view
:add-tree-view-column)) :add-tree-view-column
:tree-view-selected-row))
7 changes: 7 additions & 0 deletions stores-and-views.lisp
Expand Up @@ -82,3 +82,10 @@ entries, and signals for the insertion of all the new entries."
(tree-view-column-pack-start column renderer) (tree-view-column-pack-start column renderer)
(tree-view-column-add-attribute column renderer "text" col-index) (tree-view-column-add-attribute column renderer "text" col-index)
(tree-view-append-column view column))) (tree-view-append-column view column)))

(defun tree-view-selected-row (view)
"Return the selected row index from tree-view, which presents a
list-store."
(let ((row-paths (tree-selection-selected-rows (tree-view-selection view))))
(when row-paths
(first (tree-path-indices (first row-paths))))))

0 comments on commit 41fd636

Please sign in to comment.