Skip navigation.
 
mlRe: This has to be easy...
FROM : Brian O'Brien
DATE : Fri Apr 01 23:50:05 2005

Thank you so much for you answer Todd.
These thoughts have occurred to me as-well.
If I can't get the NSResponder working then this is what I will have to
do.

When I created the controller last (as you suspected) it was defined as

@interface MyController : NSObject

So I changed that to:

@interface MyController : NSResponder

I added the mouse wheel event handler to the controller class:

- (void)scrollWheel:(NSEvent *)theEvent

I recompiled, but I didn't receive mouse wheel input.  Is there more
to it than that?  Do I need
to register for these events in awakeFromNib or something?


On Apr 1, 2005, at 2:35 PM, Todd Yandell wrote:

> Hi,
>
> Only objects that inherit from NSResponder can receive mouse or key
> events. Normal classes that simply extend NSObject will not be able to
> receive any of the input events. Instead, I would just catch the event
> in each of the views, direct it to the controller class, and let the
> controller send it out individually to each view. For example:
>
> ImageViewSubclass.m:
>
> - (void)scrollWheel:(NSEvent *)event
> {
>     [controller sendScrollEvents:event];
> }
>
> - (void)handleScrollWheel:(NSEvent *)event
> {
>     // Perform Scroll Action
> }
>
> YourControllerClass.m:
>
> - (void)sendScrollEvents:(NSEvent *)event
> {
>     [view1 handleScrollWheel:event];
>     [view2 handleScrollWheel:event];
>     [view3 handleScrollWheel:event];
> }

Related mailsAuthorDate
mlThis has to be easy... Brian O'Brien Apr 1, 22:37
mlRe: This has to be easy... Brian O'Brien Apr 1, 23:50
mlRe: This has to be easy... Anish Kumar Apr 4, 06:54