CLIM mail archive

[Prev][Next][Index][Thread]

accept




Hello CLIMers,

I have just another problem with accept inside an accepting value.
It works fine, if you enter values from the wanted presentation-type,
but it works not very fine, if you enter wrong-type values
(e.g. 1/2 where CLIM expects an integer) CLIM writes:

   The input read, 1/2, was not an integer.
   Please edit your input.

   1/2

O.K. But any other output (of other accepts in the same accepting-value-macro)
is over-written. That doesn't look very nice.

To get the feeling just start the test-code (from the CLIM-manual), click on
'Set Time' and enter 1/2 for month.

Any hints to avoid this effect?

Future thanks, Ralf.


P.S.: The test-code

;;; -*- Package: CLIM-USER; Syntax: Common-Lisp; Base: 10 -*-

(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~%")
    (conditions: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")))
	(format t "~%New values: Month: ~D, Day: ~D, Time: ~D:~2,'0D."
		month day hour minute))
      (abort () (format t "~&Time not set")))))

(define-application-frame myapp ()
    ()
  (:panes ((menu :command-menu)
	   (main :application
		 :scroll-bars nil		      ; :vertical
		 :display-function 'display-main
		 :display-after-commands nil)
	   (interactor :interactor)))
  (:layout
    ((main 
       (:column :rest
	(menu :compute)
	(main 3/4)
	(interactor :rest))))))

(defmethod display-main ((frame myapp) stream)
  (declare (ignore stream)))

(define-myapp-command (com-myapp-set-time :name t :menu "Set Time") ()
  (reset-clock (get-frame-pane *application-frame* 'main)))

(define-myapp-command (com-myapp-exit :name t :menu "Exit") ()
  (let ((window (frame-top-level-window *application-frame*)))
    (window-clear window)
    (setf (window-visibility window) nil)
    (window-visibility window)
    (frame-exit *application-frame*)))

(defvar *clim-root* (clim:open-root-window :sheet))

(defun run ()
  (let ((tach (clim:make-application-frame 'MYAPP :parent *clim-root*
					  :left 50 :right 850 :top 50 :bottom 700)))
    (setf (output-recording-stream-output-record (get-frame-pane tach 'main))
	  (make-instance 'clim::linear-output-record))
    (process:process-run-function "task" #'clim:run-frame-top-level tach)))



Main Index | Thread Index