🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #1895

Re: Can a View delegate its event handling capability?

#1895
From: Rick Mohr
Date: Mon, 23 Nov 1992 08:21
35 lines
2064 bytes
I got 5 suggestions and 2 "me too's" in response to my question on how to
get a "tool object" to handle events for a document view.  The only solution
that really does the job in my opinion is to insert the tool object into the
responder chain as the View's next responder.  That was suggested by one
person and appears below.

-Rick


From: Josh Doenias <Josh_Doenias@NeXT.COM>
Date: Tue, 17 Nov 92 20:23:28 -0800
To: mohr-eric@CS.YALE.EDU (Rick Mohr)
Subject: Re: Can a View delegate its event handling capability?

In comp.sys.next.programmer article
<199211162313.AA25672@NEBULA.SYSTEMSZ.CS.YALE.EDU> you wrote:
>Can a View delegate its event handling capability?
>
...
>
>When a window object receives a "mouseDown" event message from the window
>manager it determines what View gets first crack at the event and sends it a
>mouseDown: message.  What I want is some way for the view to say "instead of
>sending ME event messages, send them instead to HIM (the selected tool
>object)."  Do I have to subclass window and duplicate the event distribution
>capability??

This is the whole idea behind the Responder object and Responder chain.
A View gets messages like "mouseDown:" and "keyDown:" because it is a
Responder object. If the view didn't respond to any of these messages, the
event will get passed down to the nextResponder.

You can simply set up your tools to have the behavior you described by
making the Tools subclasses of Responder.  Then, whenever a tool is
selected, you can make that tool the nextResponder
Technical Details
Message-ID: <199211231821.AA25132@NEBULA.SYSTEMSZ.CS.YALE.EDU>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!cs.yale.edu!news-mail-gateway!daemon
References: mohr-eric@CS.YALE.EDU (Rick Mohr)

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!cs.yale.edu!news-mail-gateway!daemon
From: mohr-eric@CS.YALE.EDU (Rick Mohr)
Subject: Re: Can a View delegate its event handling capability?
Message-ID: <199211231821.AA25132@NEBULA.SYSTEMSZ.CS.YALE.EDU>
Sender: mohr-eric@CS.YALE.EDU
Organization: Yale CS Mail/News Gateway
References: mohr-eric@CS.YALE.EDU (Rick Mohr)
Date: Mon, 23 Nov 1992 08:21:14 GMT
Lines: 37