CLIM mail archive

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

stopping echoing of accepting?



   Date: Fri, 6 Dec 91 17:25:28 CST
   From: David Neves <neves@ils.nwu.edu>

   We wrote our own simple version of accept to get around this problem using
   read-gesture and find-innermost-applicable-presentation. 
   find-innermost-applicable-presentation wants an input context whose
   structure or creation isn't documentated very well in the manual.  The only
   way we could think of creating it was to wrap
   find-innermost-applicable-presentation within with-input-context and using
   the variable *input-context* for the input context.  Is there a better way?

   e.g.
   (defun get-user-input (stream)
     (let ((gesture (read-gesture :stream stream))
	   presentation)
       (typecase gesture
	 (POINTER-BUTTON-PRESS-EVENT
	  (setf presentation
		(with-input-context (t) nil
		      (find-innermost-applicable-presentation *input-context*
   stream 
							(pointer-event-x
   gesture)
							(pointer-event-y
   gesture))
		  nil))
	  (if presentation
	    (values (presentation-object presentation) 
		    (presentation-type presentation))
	    nil))
	 (t gesture))))

WITH-INPUT-CONTEXT is all you really need in order to write your
GET-USER-INPUT function.  (Note that neither it, nor your
implementation, solves the original problem, though, which involved
suppressing echoing of typed input.)

Here is your function rewritten.  (I have not tested this code because
I am not sitting in front of a CLIM.)

(defun get-user-input (stream &optional (desired-type t))
  (with-input-context (desired-type) 
                      (object type)
       (read-gesture :stream stream)
    (t (values object type))))

[A perhaps more appropriate implementation for your purposes puts the
READ-GESTURE inside a loop, so that a mouse click is required to
terminate.]

0, answered,,

References:

Main Index | Thread Index