Next Prev Up Top Contents Index

1.5 Testing Code Examples

These instructions assume that a CLIM image has already been built, or that CLIM has been loaded. Load CLIM via (require "clim"). If you are a first-time user, load the sample file provided in the release directory:

> (load "

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 (QUIT) to quit Lisp.

To keep the User Guide concise, many of the examples in it are simply code segments. To try them out, 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))
   (main :application :display-function 'display-main)
   (prompter :interactor))
   (: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))

Common Lisp Interface Manager 2.0 User Guide - 14 Dec 2001

Next Prev Up Top Contents Index