CLIM mail archive


re: Accepting values and commands

    Date: Mon, 19 Oct 1992 19:51 EDT
    From: Robin Kladke (303)977-9760 <>

    I tried the CLIM 1.1 bug fix for the dialog problem, but see no difference.  I
    compiled and loaded the code then called the following general popup window
    routine.  The values are still reset to their defaults when previous values are
    changed.  Ideas?

Look what you are passing as the default to the three calls to ACCEPT
(indicated with arrows).  Each time through the dialog, you are calling
ACCEPT with the same (or no) default.  You need to update the default to
the new value, and use that as the default.

    ----Begin Code----

    ;;; -*- Mode: LISP; Syntax: Common-lisp; Package: COMMON-LISP-USER; Base: 10 -*-

    (defun general-popup (&key (header nil) (source nil)
			  (dest-type 'integer) (dest-reqd nil)
			  (dest-default nil) (msg nil)
			  (prompt "Enter a Message")
			  (resp-type 'string) (resp-reqd nil)
			  (stream (clim:open-root-window :sheet)))
      (let ((response nil) (exit-boxes nil) (abort-msg nil) (destination nil)
	    (new-resp-reqd nil) (dest-prompt nil))
	(cond (resp-reqd 
	       (setq exit-boxes '((:exit "<End> uses these values")
				  (:abort "<Abort> aborts out of the system!"
	       (setq abort-msg
		     (format nil "~A~A"
			     "~%Message MUST be acknowedged! Try again...")))
	       (setq exit-boxes '((:exit "<End> exits this window")
				  (:abort "<Abort> aborts out of the system!"
	       (setq abort-msg "")))

	    (clim:accepting-values (stream
				     :own-window '(:right-margin 300 :bottom-margin 100)
				     :exit-boxes exit-boxes
				     :x-position 0
				     :y-position 0
	      (when header
		(format stream "~A~%~%" header))
	      (when source
		(format stream "~%Message Source: ~A~%" source))
	      (when msg
		(format stream "~%Message: ~A~%~%" msg))

	      (cond (dest-reqd
		     (setq dest-prompt
			   (format nil "Enter a Destination ID (Default=~A)" dest-default))
		     (setq destination (clim:accept dest-type
						    :stream stream
						    :prompt dest-prompt
						    ;; See NOTE#1 in header
-->						    :default dest-default 
						    :provide-default t
		     (terpri stream)
		     (terpri stream))
		    (t (setq destination t)))
	      (cond (resp-reqd 
		     (setq response (clim:accept resp-type
-->						 :stream stream
						 :prompt prompt))
		     (terpri stream) (terpri stream)
		     (terpri stream)
		     (terpri stream)
		     (setq new-resp-reqd (clim:accept '(integer 0 1)
						      :stream stream
						      :prompt "Is acknowledgement required (0=No [Default], 1=Yes)? "
						      :prompt-mode :raw
						      ;; See NOTE#1 in header
-->						      :default 0
						      :provide-default t
		     (terpri stream) (terpri stream)
		     (terpri stream) (terpri stream)
		     (terpri stream) (terpri stream)
		    (t (setq response t)))
	  (abort () (format t abort-msg)))

	;; if the user doesn't respond by giving no answer, a null answer, or aborting,
	;; pop the window up again
	(cond ((or (null response) (string-equal (princ-to-string response) "")
		   ;(null destination) (string-equal (princ-to-string destination) "")
	       (multiple-value-setq  (response destination new-resp-reqd)
		   :header header
		   :source source :dest-type dest-type :dest-reqd dest-reqd
		   :dest-default dest-default :msg msg :prompt prompt :resp-type resp-type
		   :resp-reqd resp-reqd :stream stream)))

	(values response destination new-resp-reqd)



Main Index | Thread Index