Ltk:チェックボタンを表示する - lisp-cookbook-ja/common-lisp GitHub Wiki

  • チェックボタン
;;; LTKでチェックボタンを表示する

(ql:quickload :ltk)


;; パッケージの作成
(defpackage :ex4-05
  (:use :common-lisp
        :ltk)
  (:export :main))

(in-package :ex4-05)

(defun main ()
  (with-ltk ()
    (let* (
           (cbtn1 (make-instance
                'check-button
                :text "check button1"
                :command (lambda (value)
                           (format t "check-button1:~A~%" value)
                           )))

           (cbtn2 (make-instance
                'check-button
                :text "check button2"))

           (cbtn3 (make-instance
                'check-button
                :text "Close"))

           (btn (make-instance
                 'button
                 :text "check on!"
                 :command (lambda ()
                             (setf (value cbtn1) t)
                             (print (value cbtn1)))))
           )
      (pack (list cbtn1 cbtn2 cbtn3) :side :top :fill :both :expand :yes) ; fill,both,expand,yesを指定すると、Wiindowのハシをドラッグして伸ばしても、ボタンが上下左右に大きくなる。
      (pack btn :side :top :fill :both :expand :yes)
      )))

(main)