Merge pull request #1007 from alexey-savchuk/feat/1004-treeview-get-selected-func

Feat: add GetSelectedFunc method for TreeView component
This commit is contained in:
rivo 2024-08-05 13:17:17 +02:00 committed by GitHub
commit 08da3ea457
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -450,6 +450,12 @@ func (t *TreeView) SetSelectedFunc(handler func(node *TreeNode)) *TreeView {
return t return t
} }
// GetSelectedFunc returns the function set with [TreeView.SetSelectedFunc]
// or nil if no such function has been set.
func (t *TreeView) GetSelectedFunc() func(node *TreeNode) {
return t.selected
}
// SetDoneFunc sets a handler which is called whenever the user presses the // SetDoneFunc sets a handler which is called whenever the user presses the
// Escape, Tab, or Backtab key. // Escape, Tab, or Backtab key.
func (t *TreeView) SetDoneFunc(handler func(key tcell.Key)) *TreeView { func (t *TreeView) SetDoneFunc(handler func(key tcell.Key)) *TreeView {