CLIM mail archive
[Prev][Next][Index][Thread]
stopping echoing of accepting?
Date: Fri, 6 Dec 1991 10:12 PST
From: Scott McKay <SWM@sapsucker.scrc.symbolics.com>
Date: Thu, 5 Dec 1991 12:34 EST
From: neves@ils.nwu.edu
I want to accept something in a window but whatever I accept gets echoed in
the window (see below for example code). How do I stop the echoing?
(This is in MAC CLIM).
-Thanks, David
(in-package clim-user)
(setq root (open-root-window :mcl))
(setq w (open-window-stream :parent root))
(present 3 'integer :stream w)
(accept 'integer :stream w :prompt nil)
ACCEPT in development version of CLIM has a :REPLACE-INPUT keyword to
which you can supply a value of NIL to prevent echoing when you click
on something. There is no way to cause CLIM not to echo typed input
to ACCEPT.
Perhaps I've misunderstood something, but SWM's last statement is
incorrect in the general case. The code fragment
(format stream "~&Enter a string: ")
(with-output-recording-options (stream :draw-p nil)
(accept 'string :prompt nil :stream stream)))
will accept a string from the user without echoing it. We used a
variation on this theme to write the following presentation type:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Clip here ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; The PASSWORD presentation type.
;;;
;;; A password is just a string that is never displayed. The
;;; presentation type has its own PRESENT and ACCEPT methods, but
;;; inherits everything else from STRING.
(define-presentation-type password ()
:inherit-from '((string) :description "password"))
;;; Presenting a password prints a string of X's.
(define-presentation-method present (password (type password)
stream (view textual-view)
&key &allow-other-keys)
(write-string (make-string (length password)
:initial-element #\X)
stream))
;;; Accepting a password turns off output drawing and recording,
;;; then reads a string using READ-TOKEN.
(define-presentation-method accept ((type password) stream
(view textual-view)
&key &allow-other-keys)
(with-output-recording-options (stream :draw-p nil
:record-p nil)
(read-token stream)))
0,,
References:
Main Index |
Thread Index