Initial focus item in tree-view
Hi, My application has a dialog box that contains a tree view that lets the user select a value from the tree. The next time this dialog box is opened, I want the initially selected item in that tree view to be the value that the user chose the last time. I tried out various experiments with (SETF CAPI:CHOICE-SELECTED-ITEM) and the :INITIAL-FOCUS-ITEM initarg, but I can't get it to work. As soon as the tree view gets the focus for the first time, the first value in the tree automatically gets the focus (which is not what I want). I would appreciate any suggestions for how I should approach this. Thanks, Arthur ---------------- ;; This is one approach that I tried. (in-package :cl-user) (defclass test-tree (capi:tree-view) () (:default-initargs :roots '(0 1 2 3) :children-function (lambda (n) (and (< n 100) (loop for i below 10 collect (+ (* 10 n) i)))) :interaction :single-selection)) (defmethod initialize-instance :around ((test test-tree) &rest args &key &allow-other-keys) (apply #'call-next-method test ;; This should make sure that the 123 node is selected ;; initially, but it doesn't work. :initial-focus-item 123 args)) (defun test-it () (capi:contain (make-instance 'test-tree)))