Skip to content

Instantly share code, notes, and snippets.

Created Jul 12, 2014
What would you like to do?
clim app4
(in-package :cl-user)
(ql:quickload :clx)
(ql:quickload :mcclim)
(defpackage app
(:use :clim
(in-package :app)
(define-application-frame superapp ()
:initform (loop repeat 20 collect (list (random 100000000)))
:accessor numbers)
:initform 0
:accessor cursor))
:height 400
:width 600
:incremental-redisplay t
:display-function 'display-app)
:height 200
:width 600))
(default (vertically () app int))))
(defun display-app (frame pane)
(loop for elm in (numbers frame)
for line from 0 do
(if (= line (cursor frame)) "*" " ")
:unique-id elm
:id-test #'eq
:cache-value (car elm)
:cache-test #'eql
(format pane "~A~%" (car elm))))))
(defun app-main ()
(make-application-frame 'superapp)))
(define-superapp-command (com-quit :name t) ()
(frame-exit *application-frame*))
(define-superapp-command (com-add :name t) ((number 'integer))
(car (elt (numbers *application-frame*)
(cursor *application-frame*)))
(define-superapp-command (com-next :name t) ()
(incf (cursor *application-frame*))
(when (= (cursor *application-frame*)
(length (numbers *application-frame*)))
(setf (cursor *application-frame*) 0)))
(define-superapp-command (com-prev :name t) ()
(decf (cursor *application-frame*))
(when (minusp (cursor *application-frame*))
(setf (cursor *application-frame*)
(1- (length (numbers *application-frame*))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment