Chapter 1 Using CLIM

1.5 Testing Code Examples in Liquid CLIM

These instructions assume that a Liquid CLIM image has already been built. (See your Liquid Release and Installation Notes if this is not the case). To start a CLIM image, load your CLIM code. If you are a first-time user, load the sample file provided in the release directory:

> (load "<release directory>/template.lisp")
Next, type the following at the Lisp prompt:

> (run-frame-top-level
    (make-application-frame 'test :width 400 :height 500))
To exit the application and return to the Lisp top level, left-click on the Exit menu item. Type(LCL:QUIT) to quit Lisp.

To keep the User's Guide concise, many of the examples in it are simply code segments. To try them out in Liquid Common Lisp, you need some supporting CLIM code that defines an application frame. The file loaded previously is one such template. It contains the following code:


(in-package :clim-user)

(define-application-frame test
  ()
  ((height :initform 55 :accessor height))
  (:panes
   (main :application :display-function 'display-main)
   (prompter :interactor))
  (:layouts 
   (:default (vertically ()
                         (2/3 (bordering () main))
                         (1/3 prompter)))))

(defmethod display-main ((frame test) stream)
  (let ((x 55)
        (y 55)
        (width 55))
    (draw-rectangle* stream x y (+ x width) (+ y (height frame))
                     :ink +red+)))

(define-test-command (com-exit :menu "Exit" :name t) ()
  (frame-exit *application-frame*))

(define-test-command (com-test :menu "Test" :name t)
  ((new-height 'integer :default (height *application-frame*)))
  "Changes the default value of the height slot."
  (setf (height *application-frame*) new-height))


CLIM 2.0 User's Guide - OCT 1998

Generated with Harlequin WebMaker