home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.lisp.mcl
- Path: sparky!uunet!paladin.american.edu!darwin.sura.net!spool.mu.edu!agate!boulder!cambridge.apple.com!apple!ames!ncar!uchinews!tango.uchicago.edu!mcdougal
- From: mcdougal@cs.uchicago.edu (Tom McDougal)
- Subject: basic view-key-event-handler confusion
- Message-ID: <722101331.26830@news.Colorado.EDU>
- Lines: 41
- Sender: news
- Organization: Univ. of Chicago Computer Science
- Distribution: co
- Date: 17 Nov 92 21:52:12 GMT
- Approved: news
- X-Note1: mail msgid was <1992Nov17.215212.7762@midway.uchicago.edu>
- X-Note2: message-id generated by recnews
- Lines: 41
-
- Please help.
-
- There is something *very basic* that I don't understand about
- view-key-event-handlers, despite having read and re-read
- the docs and sample code a hundred times. Here is a simple
- example that fails to handle key events -- all keystrokes go
- to the listener:
-
- (defclass simple-key-handling-view (dialog-item)
- ()
- )
-
- ;;; When you get a keystroke, draw that character.
- ;;; ***BUT NOTHING HAPPENS
-
- (defmethod view-key-event-handler ((item simple-key-handling-view)
- char)
- "Just print the character in the view."
- (when (integerp char) (setq char (code-char char))) ; (why?)
- (move-to item 20 20)
- (format item "~c" char))
-
- (setq *w* (make-instance 'window))
- (setq *v* (make-instance 'simple-key-handling-view
- :view-position #@(4 4)
- :view-size #@(200 200)))
-
- (add-subviews *w* *v*)
-
- ;;; (key-handler-p *v*) --> NIL
-
-
- Please don't tell me to use an instance of some text dialog
- item; I want to do something very special with the keystrokes,
- and anyway there must be a simpler way...
-
- Many, many thanks for your kind attention.
-
- ----------------------------------------------------------------------
- -Tom McDougal mcdougal@cs.uchicago.edu (312) 702-0024
- Dept. of Computer Science, University of Chicago
-