Thread View: comp.sys.next.programmer
1 messages
1 total messages
Started by Rick Mohr
Mon, 16 Nov 1992 13:13
Can a View delegate its event handling capability?
Author: Rick Mohr
Date: Mon, 16 Nov 1992 13:13
Date: Mon, 16 Nov 1992 13:13
28 lines
1876 bytes
1876 bytes
Can a View delegate its event handling capability? Think of a standard document-based app with a document window and a tool bar. Each tool establishes its own set of event meanings; for example, "mouseDown and drag" might mean "select an object and move it" to a pointer tool and might mean "create a rectangle and size it" to a box-creation tool. In the obvious implementation, a View object receives an event, checks a "selectedTool" variable and interprets the event accordingly. But it would be nice if the tools could be written in an object-oriented fashion, each providing its own method for mouseDown and any other events it wanted to handle. I can't think of any way of doing this that doesn't require the View to declare its own mouseDown method, check what tool is selected, and call that tool's mouseDown method. Not much code, to be sure, but the View must provide such a method for ALL events that some tool might want to catch. Making the tool the first responder would work for some events but not others. 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?? Email responses appreciated. -Rick
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads