Hi,
A question came up on #lisp yesterday: essentially, it asked how to dynamically change the contents of a pane, in a similar way to changing layouts of a frame. My intuitive answer was to reinitialize the pane with a new :contents initarg, which was quickly followed by an intuitive suspicion that this wouldn't actually work in McCLIM currently. (The suspicion was strengthened by the example in the spec in 29.5.2, which doesn't define any bookkeeping for reinitialization, and confirmed when I actually tried it...)
So, the first question: should what I suggested work in principle, or is there a reason why we shouldn't allow it (and what should be allowed instead?). The second question: if it should work, is there anything wrong with the attached implementation, apart from its cut-and-paste nature? Is there something in the protocols that I am not following? To try it out, run the vbox's toplevel, then issue the commands Double, followed by Draw.
Comments?
Cheers,
Christophe
On 2/14/07, Christophe Rhodes csr21@cantab.net wrote:
A question came up on #lisp yesterday: essentially, it asked how to dynamically change the contents of a pane, in a similar way to changing layouts of a frame.
Apologies if I'm sending this twice, as gmail freaked out the first time around.
In the method browser example, I use sheet-adopt-child for this. (setf sheet-children) isn't in the spec, but seems like it should be the natural way to change all of the children. McCLIM has such a function, but it is not useful to user code, because (at least for the box layout panes) part of the magic is attached to sheet-adopt-child such that even explicitly following (push new-child (sheet-children a-box-or-rack-pane)) with (reorder-sheets ..) doesn't make the new child appear, despite now appearing in the list returned by sheet-children.
Incidentally, your approach of using reinitialize-instance is an idiom I was not familiar with.
Hopefully posting gtkairo bugs is not punishable :-)
Both of those are in fresh cvs mcclim, and both of those do not seem to happen with CLX.
1. Redraw stops in tabdemo when i click the rightmost tab, and then the "C" tab
2. The following short program illustrates that :min-width/height is not respected:
(define-application-frame tabdemo () () (:menu-bar tabdemo-menubar) (:panes (a :text-editor :value "Hello World from page A" :min-height 100 :min-width 100)) (:layouts (default (vertically () (with-tab-layout ('tab-page :name 'tabdemo-layout :height 200) ("A" a))))))
(define-tabdemo-command (com-quit-tabdemo :menu t) () (frame-exit *application-frame*))
(make-command-table 'tabdemo-menu :errorp nil :menu '(("later on" :command com-quit-tabdemo)))
(make-command-table 'tabdemo-menubar :errorp nil :menu '(("menu" :menu tabdemo-menu)))
(defun tabdemo () (run-frame-top-level (make-application-frame 'tabdemo)))
(defun sane-find-pane-named (frame name) (find name (climi::frame-named-panes frame) :key #'pane-name :test #'string-equal))
(defun tabdemo-layout () (sane-find-pane-named *application-frame* 'tabdemo-layout))
regards, Samium Gromoff