CLIM mail archive

[Prev][Next][Index][Thread]

:panes option to define-application-frame



Please send bug reports for CLIM 0.9 to Bug-CLIM@ILA.COM in the future.
Thanks.

    Date: Fri, 1 Feb 91 12:40 PST
    From: will taylor <taylor@charon.arc.nasa.gov>

    In Franz Allegro 3.1.13, CLIM 0.9, I donot seem to be able
    to construct a frame of multiple layouts: I get #:frame
    declared special when I compile it, and unbound symbol
    #:frame when I try to create it.  Code follows:

The :PANES option to DEFINE-APPLICATION-FRAME is, unfortunately,
difficult to use without an example.  I don't think we publish any
examples of its use.  I believe this section of the documentation will
be substantially rewritten for the next release.

Also, I believe there is a bug in the implementation of
SELECT-FRAME-LAYOUT which was shipped with 0.9.  There is a patch
numbered 37 which is supposed to fix this, but it has a bug in it.  I
will ask one of the ILA folks in Cambridge to fix this for real, but I
will include the source of the fixed fix below.

If you had patch 37 loaded, you would at least have been warned that
your :PANES option had a syntax error in it, by the way.  Here is
approximately what it says now:

   Warning: A layout name must be a symbol, not
	    (CLASS-WTS/ALL-CLASSES-CONFIG :INITFORM ...). 

The documentation says of the :PANES option:
  Its format is a list of two-element lists.  The first element of each
  sublist is a symbol naming the layout; the second element is a form
  what evaluates to a pane.

So, your frame should say:

(define-application-frame AC-BUG
			  ()		; No super classes
  ;; state variables
  ((banner-pane :initform nil :accessor banner-pane)
   (command-pane :initform nil :accessor command-pane)
   )

  ;; frame layouts
  (:panes
;;; Note no extra set of parentheses, and no :INITFORM keyword
    (class-wts/all-classes-config
      (let ((frame-mgr (find-frame-manager :server-path *default-server-path*)))
	(with-frame (frame)
	  (with-style (frame-mgr frame)
	    (with-frame-slots (banner-pane command-pane)
	      (vertically
		(make-clim-pane (banner-pane :type  'clim-stream-pane
					     :hs 600 :vs 40 :scroll-bars nil
					     :label "NASA Ames Research Center - FIA")
				:default-text-style '(:fix :bold :very-large))
		(make-clim-pane (command-pane :type 'command-pane-class
					      :hs 600 :vs 30 :scroll-bars nil)
				:default-text-style '(:sans-serif :bold :large))))))))


;;; Selecting one of the following configurations would cause an error,
;;; of course, since the second element of the list does not evaluate to
;;; a pane.
    (class-wts/all-attributes-config
      ())
    (all-classes/all-attributes-config
      ())
    (double=all-attributes-config
      ())
    (double=all-classes-config
      ())
    (metrics-config
      ())
    (plot-config
      ())
    (doc-config
      ())
    ))
    
      (:command-definer t)
      (:top-level (clim-top-level))
      )

By the way, here is a cliche you may want to use with the :PANES option.
Remember that if you want to reuse already-created panes in different
configurations, you need to write them down someplace:

(define-application-frame two-configurations ()
  ((pane-a :initform nil)
   (pane-b :initform nil))
  (:panes
    (configuration-1
      (with-frame-slots (pane-a pane-b)
	(vertically
	  (or pane-a (make-clim-pane (pane-a ...) ...))
	  (or pane-b (make-clim-pane (pane-b ...) ...)))))
    (configuration-2
      (with-frame-slots (pane-a pane-b)
	(horizontally
	  (or pane-a (make-clim-pane (pane-a ...) ...))
	  (or pane-b (make-clim-pane (pane-b ...) ...)))))))

-----------------------------------------------------------------
Here is the fixed version of SELECT-FRAME-LAYOUT:
-----------------------------------------------------------------
(in-package :windshield)

(defmethod select-frame-layout ((frame frame) layout &optional how)
  (let ((manager (frame-manager frame))
	(*old-layout* (frame-pane frame))
	*new-layout*)
    (declare (special *new-layout* *old-layout*))

    (assert manager ()
	    "A frame must be adopted before a layout can be changed")
    
    ;; slot-unbound takes care of building the layout if necessary.
    (setq *new-layout* (slot-value frame layout))

    ;; Need to be able to do (pane-frame <something-in-new-layout>) soon.
    (register-pane-frame *new-layout* frame)

    (selecting-frame-layout manager frame *new-layout* how)
    (setf (frame-pane frame) *new-layout*)
    
    ;; Don't need to do (pame-frame <something-in-old-layout>) any more.
    (unregister-pane-frame *old-layout*)))

0,,

References:

Main Index | Thread Index