From: Paolo Amoroso
Subject: Creating CLIM gadgets to frames at run time
Date: 
Message-ID: <87lljaf6f0.fsf@plato.moon.paoloamoroso.it>
Is it possible to create and add CLIM gadgets at run time to a frame
layout, i.e. gadgets that are not yet known when the frame is defined?
Is there any sample code?


Paolo
-- 
Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film
Recommended Common Lisp libraries/tools (Google for info on each):
- ASDF/ASDF-INSTALL: system building/installation
- CL-PPCRE: regular expressions
- UFFI: Foreign Function Interface
From: Paolo Amoroso
Subject: Re: Creating CLIM gadgets to frames at run time
Date: 
Message-ID: <87pt7sc3md.fsf@plato.moon.paoloamoroso.it>
Paolo Amoroso <·······@mclink.it> writes:

> Is it possible to create and add CLIM gadgets at run time to a frame
> layout, i.e. gadgets that are not yet known when the frame is defined?

Andy Hefner suggested to create the pane with MAKE-PANE, and use
SHEET-ADOPT-CHILD to parent it into an existing layout pane.  Here is
an example I have put together:

(in-package :clim-user)

(define-application-frame dynamic-panes ()
  ()
  (:panes
   (interactor :interactor)
   (hbox-layout (make-pane 'hbox-pane)))
  (:layouts
   (default (vertically () interactor hbox-layout))))

(define-dynamic-panes-command (com-dynamic :menu t :name t) ()
  (with-look-and-feel-realization (*default-frame-manager* *application-frame*)
    (let ((button (make-pane 'push-button :label "Dynamically Generated"))
          (layout-pane (find-pane-named *application-frame* 'hbox-layout)))
      (sheet-adopt-child layout-pane button))))

(define-dynamic-panes-command (com-quit :menu t :name t) ()
  (frame-exit *application-frame*))

In order to run it with McCLIM, you need CVS sources later than 21
June 2004, with a fix by Andy to a named panes problem that prevented
the above code to work.


Paolo
-- 
Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film
Recommended Common Lisp libraries/tools (Google for info on each):
- ASDF/ASDF-INSTALL: system building/installation
- CL-PPCRE: regular expressions
- UFFI: Foreign Function Interface