home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / lisp / mcl / 1573 < prev    next >
Encoding:
Text File  |  1992-11-11  |  2.4 KB  |  60 lines

  1. Newsgroups: comp.lang.lisp.mcl
  2. Path: sparky!uunet!destroyer!ncar!uchinews!tango.uchicago.edu!mcdougal
  3. From: Tom McDougal <mcdougal@cs.uchicago.edu>
  4. Subject: Re: parallel text dialog items
  5. Message-ID: <1992Nov11.203652.13115@midway.uchicago.edu>
  6. X-Xxmessage-Id: <A726C7D6B0071453@tango.uchicago.edu>
  7. X-Xxdate: Wed, 11 Nov 92 20:23:18 GMT
  8. Sender: news@uchinews.uchicago.edu (News System)
  9. Organization: Univ. of Chicago Computer Science
  10. X-Useragent: Nuntius v1.1.1d12
  11. References: <1992Nov9.170736.5118@midway.uchicago.edu>
  12. Date: Wed, 11 Nov 1992 20:36:52 GMT
  13. Lines: 45
  14.  
  15. First, there was a biiiig mistake in my original code, which
  16. should have been obvious.  See if you can spot it:
  17.  
  18. >> (defclass twin-text-item (aligned-text-dialog-item)
  19. >>   ((brother :accessor brother :initarg :brother 
  20. >>             :type 'text-edit-dialog-item)))
  21. >> 
  22. >> (defmethod key-event-handler :after ((self twin-text-item) char)
  23. >>   (key-event-handler (brother self) char))
  24.  
  25. See it?  'key-event-handler' should have been
  26. 'view-key-event-handler'.  
  27.  
  28. Given that correction, the code above works for instances of
  29. editable-text-dialog-item, but not for instances of
  30. text-edit-dialog-item (defined in the examples folder).  In the latter
  31. case, duplicates of each keystroke end up going to the same view.
  32. Why?
  33.  
  34. It seems as though keystrokes are always handled by the window's
  35. key-event-handler.  So the following correction works:
  36.  
  37.  (defmethod view-key-event-handler :after ((self twin-text-item) char)
  38.    ; change the window's key event handler to BROTHER's handler
  39.    (set-key-event-handler (view-container self)
  40.                           (key-event-handler (brother self)))
  41.    ; process the keystroke again
  42.    (view-key-event-handler (brother self) char)
  43.    ; restore SELF's handler as window's key event handler
  44.    (set-key-event-handler (view-container self) (key-event-handler
  45. self)))
  46.  
  47. All suggestions have involved using editable-text-dialog-items, which
  48. I will use if necessary, but the whole reason for going to text-edit-
  49. dialog-items was to avoid the extra bulk of fred dialog items.
  50.  
  51. Anyway, thanks for the tips.
  52.  
  53. ----------------------------------------------------------------------
  54. -Tom McDougal          mcdougal@cs.uchicago.edu         (312) 702-0024
  55. Dept. of Computer Science, University of Chicago
  56.  
  57.         1051, Lady Godiva puts everything she has
  58.         on a horse.  Citizens of Coventry place bets
  59.         for Godiva to show.
  60.