How to transfer focus from tree-view
I would like to have the focus change to another pane when a tree-view
node is selected. Stepping through the code, I can see that this works,
but when the selection-callback is exited, focus transfers back to the
tree-view.
Can I make the focus change stay where the callback puts it? Thanks for
any help.
Mitch
This demonstrates:
(capi:define-interface focus-test-interface ()
()
(:panes
(test-pane-1
capi:text-input-pane
:accessor test-pane-1
:title "Test Pane 1"
:title-position :frame
:visible-min-height 50)
(test-pane-2
capi:text-input-pane
:accessor test-pane-2
:title "Test Pane 2"
:title-position :frame
:visible-min-height 50)
(pick-tree
capi:tree-view
:roots '(0)
:children-function #'(lambda (x) (when (= x 0) (list 1 2)))
:selection-callback 'pick-tree-callback
:callback-type :interface-data
:visible-min-height 100))
(:layouts
(main-layout
capi:column-layout
'(test-pane-1 test-pane-2 pick-tree)))
(:default-initargs
:layout 'main-layout
:best-width 100
:title "Focus test"))
(defun pick-tree-callback (interface data)
(cond
((= data 1)
(capi:apply-in-pane-process interface #'capi:set-pane-focus
(test-pane-1 interface)))
((= data 2)
(capi:apply-in-pane-process interface #'capi:set-pane-focus
(test-pane-2 interface)))))
(capi:contain (make-instance 'focus-test-interface))