All Manuals > Common Lisp Interface Manager 2.0 User's Guide > Chapter 12 Menus and Dialogs > 12.4 Examples of Menus and Dialogs in CLIM

NextPrevUpTopContentsIndex

12.4.2 Using accept-values-command-button

Here is the reset-clock example with the addition of a command button that will set the number of seconds to zero.

(defun reset-clock (stream) 
  (multiple-value-bind (second minute hour day month) 
      (decode-universal-time (get-universal-time))
    (declare (ignore second)) 
    (format stream "Enter the time~%") 
    (restart-case 
     (progn 
       (clim:accepting-values 
        (stream) 
        (setq month 
              (clim:accept 'integer :stream stream 
                           :default month :prompt "Month")) 
        (terpri stream) 
        (setq day 
              (clim:accept 'integer :stream stream 
                           :default day :prompt "Day"))
        (terpri stream) 
        (setq hour 
              (clim:accept 'integer :stream stream 
                           :default hour :prompt "Hour")) 
        (terpri stream) 
        (setq minute 
              (clim:accept 'integer :stream stream 
                           :default minute :prompt "Minute")))
        (terpri stream)
          ;; Print the current time to the terminal.
          (accept-values-command-button
           (stream) "Print-Clock"
           (format t
                   "~%Current values: Month: ~D, Day: ~D, Time: ~D:~2,'0D."
                   month day hour minute))))
    (abort () (format t "~&Time not set")))))

Common Lisp Interface Manager 2.0 User's Guide - 20 Sep 2011

NextPrevUpTopContentsIndex