Puzzled by capi:remove-items
Hi again, Having troubling getting REMOVE-ITEMS to work as I'd expect. Was hoping that ':items-callback :redisplay-interface' would address the trouble, but CAPI is rejecting it. In the example below, a series of Tabs is appended to a TAB-LAYOUT and then removed again. There is however a 'residue' of the last Tab still visible (and selectable). As usual, I am overlooking something. 8^/ (in-package CL-USER) (capi:define-interface tab () ((items :initarg :items)) (:panes (things capi:list-panel :items items)) (:layouts (column capi:column-layout '(things))) (:default-initargs :layout 'column :visible-min-height 50 :auto-menus nil)) (defvar *tabs* `(,(make-instance 'tab :title "A" :items (list :a :a :a :a)) ,(make-instance 'tab :title "B" :items (list :b :b :b :b)) ,(make-instance 'tab :title "C" :items (list :c :c :c :c)))) (defclass tabs (capi:tab-layout) () (:default-initargs :print-function 'capi:titled-object-title :visible-child-function 'identity :items-get-function 'svref :items nil ; :items-callback :redisplay-interface ;; I'm surprised this is rejected by CAPI :title "Tabs" :title-position :frame)) (defun append-tab (tabs tab) (capi:apply-in-pane-process tabs #'(lambda (tabs) (capi:append-items tabs (list tab)) ;; Appended Tab contents won't display till selected-item is set!? (setf (capi:choice-selected-item tabs) tab)) tabs)) (defun remove-tab (tabs tab) (capi:apply-in-pane-process tabs #'(lambda (tabs) (capi:remove-items tabs (list tab))) tabs)) #| (progn (setq tabs (make-instance 'tabs)) (capi:contain tabs) ;; Append 'em (append-tab tabs (first *tabs*)) (append-tab tabs (second *tabs*)) (append-tab tabs (third *tabs*)) ;; Remove 'em (remove-tab tabs (first *tabs*)) (remove-tab tabs (second *tabs*)) (remove-tab tabs (third *tabs*)) ) |#