home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / lisp / mcl / 1612 < prev    next >
Encoding:
Text File  |  1992-11-17  |  1.8 KB  |  55 lines

  1. Path: sparky!uunet!know!mips2!news.bbn.com!seismo!darwin.sura.net!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!ncar!uchinews!tango.uchicago.edu!mcdougal
  2. From: mcdougal@cs.uchicago.edu (Tom McDougal)
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: basic view-key-event-handler confusion
  5. Message-ID: <1992Nov17.215212.7762@midway.uchicago.edu>
  6. Date: 17 Nov 92 21:52:12 GMT
  7. Sender: news@uchinews.uchicago.edu (News System)
  8. Organization: Univ. of Chicago Computer Science
  9. Lines: 41
  10. X-Xxmessage-Id: <A72EC3752B011453@tango.uchicago.edu>
  11. X-Xxdate: Tue, 17 Nov 92 21:42:45 GMT
  12. X-Useragent: Nuntius v1.1.1d12
  13.  
  14. Please help.
  15.  
  16. There is something *very basic* that I don't understand about 
  17. view-key-event-handlers, despite having read and re-read
  18. the docs and sample code a hundred times.  Here is a simple 
  19. example that fails to handle key events -- all keystrokes go 
  20. to the listener:
  21.  
  22. (defclass simple-key-handling-view (dialog-item)
  23.   ()
  24.   )
  25.  
  26. ;;; When you get a keystroke, draw that character.
  27. ;;;  ***BUT NOTHING HAPPENS
  28.  
  29. (defmethod view-key-event-handler ((item simple-key-handling-view)
  30. char)
  31.   "Just print the character in the view."
  32.   (when (integerp char) (setq char (code-char char)))  ; (why?)
  33.   (move-to item 20 20)
  34.   (format item "~c" char))
  35.  
  36. (setq *w* (make-instance 'window))
  37. (setq *v* (make-instance 'simple-key-handling-view
  38.             :view-position #@(4 4)
  39.             :view-size #@(200 200)))
  40.  
  41. (add-subviews *w* *v*)
  42.  
  43. ;;; (key-handler-p *v*)  --> NIL
  44.  
  45.  
  46. Please don't tell me to use an instance of some text dialog
  47. item; I want to do something very special with the keystrokes,
  48. and anyway there must be a simpler way...
  49.  
  50. Many, many thanks for your kind attention.
  51.  
  52. ----------------------------------------------------------------------
  53. -Tom McDougal          mcdougal@cs.uchicago.edu         (312) 702-0024
  54. Dept. of Computer Science, University of Chicago
  55.