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

  1. Newsgroups: comp.sys.next.programmer
  2. Path: sparky!uunet!gumby!yale!cs.yale.edu!news-mail-gateway!daemon
  3. From: mohr-eric@CS.YALE.EDU (Rick Mohr)
  4. Subject: Can a View delegate its event handling capability?
  5. Message-ID: <199211162313.AA25672@NEBULA.SYSTEMSZ.CS.YALE.EDU>
  6. Sender: mohr-eric@CS.YALE.EDU
  7. Organization: Yale CS Mail/News Gateway
  8. Date: Mon, 16 Nov 1992 13:13:00 GMT
  9. Lines: 29
  10.  
  11. Can a View delegate its event handling capability?
  12.  
  13. Think of a standard document-based app with a document window and a tool bar.
  14. Each tool establishes its own set of event meanings; for example, "mouseDown
  15. and drag" might mean "select an object and move it" to a pointer tool and
  16. might mean "create a rectangle and size it" to a box-creation tool.
  17.  
  18. In the obvious implementation, a View object receives an event, checks a
  19. "selectedTool" variable and interprets the event accordingly.
  20.  
  21. But it would be nice if the tools could be written in an object-oriented
  22. fashion, each providing its own method for mouseDown and any other events it
  23. wanted to handle.  I can't think of any way of doing this that doesn't require
  24. the View to declare its own mouseDown method, check what tool is selected, and
  25. call that tool's mouseDown method.  Not much code, to be sure, but the View
  26. must provide such a method for ALL events that some tool might want to catch.
  27. Making the tool the first responder would work for some events but not others.
  28.  
  29. When a window object receives a "mouseDown" event message from the window
  30. manager it determines what View gets first crack at the event and sends it a
  31. mouseDown: message.  What I want is some way for the view to say "instead of
  32. sending ME event messages, send them instead to HIM (the selected tool
  33. object)."  Do I have to subclass window and duplicate the event distribution
  34. capability??
  35.  
  36. Email responses appreciated.
  37.  
  38. -Rick
  39.  
  40.