home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / next / programm / 7378 < prev    next >
Encoding:
Text File  |  1992-11-23  |  2.0 KB  |  49 lines

  1. Newsgroups: comp.sys.next.programmer
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!cs.yale.edu!news-mail-gateway!daemon
  3. From: mohr-eric@CS.YALE.EDU (Rick Mohr)
  4. Subject: Re: Can a View delegate its event handling capability?
  5. Message-ID: <199211231821.AA25132@NEBULA.SYSTEMSZ.CS.YALE.EDU>
  6. Sender: mohr-eric@CS.YALE.EDU
  7. Organization: Yale CS Mail/News Gateway
  8. References: mohr-eric@CS.YALE.EDU (Rick Mohr)
  9. Date: Mon, 23 Nov 1992 08:21:14 GMT
  10. Lines: 37
  11.  
  12. I got 5 suggestions and 2 "me too's" in response to my question on how to
  13. get a "tool object" to handle events for a document view.  The only solution
  14. that really does the job in my opinion is to insert the tool object into the
  15. responder chain as the View's next responder.  That was suggested by one
  16. person and appears below.
  17.  
  18. -Rick
  19.  
  20.  
  21. From: Josh Doenias <Josh_Doenias@NeXT.COM>
  22. Date: Tue, 17 Nov 92 20:23:28 -0800
  23. To: mohr-eric@CS.YALE.EDU (Rick Mohr)
  24. Subject: Re: Can a View delegate its event handling capability?
  25.  
  26. In comp.sys.next.programmer article
  27. <199211162313.AA25672@NEBULA.SYSTEMSZ.CS.YALE.EDU> you wrote:
  28. >Can a View delegate its event handling capability?
  29. >
  30. ...
  31. >
  32. >When a window object receives a "mouseDown" event message from the window
  33. >manager it determines what View gets first crack at the event and sends it a
  34. >mouseDown: message.  What I want is some way for the view to say "instead of
  35. >sending ME event messages, send them instead to HIM (the selected tool
  36. >object)."  Do I have to subclass window and duplicate the event distribution
  37. >capability??
  38.  
  39. This is the whole idea behind the Responder object and Responder chain.
  40. A View gets messages like "mouseDown:" and "keyDown:" because it is a
  41. Responder object. If the view didn't respond to any of these messages, the
  42. event will get passed down to the nextResponder.
  43.  
  44. You can simply set up your tools to have the behavior you described by
  45. making the Tools subclasses of Responder.  Then, whenever a tool is
  46. selected, you can make that tool the nextResponder
  47.  
  48.  
  49.