How to forward mouse events to another view?
How to forward mouse events to another view?
- Subject: How to forward mouse events to another view?
- From: Ivan Kourtev <email@hidden>
- Date: Sun, 15 Oct 2006 14:12:40 -0400
Hello,
I have a view A containing another view B. I want to have mouse
events within B be handled by B in some situations or by the
containing view A in others.
I tried doing this using the responder chain but couldn't get it to
work (I think what I was doing applies to key events only).
Is there some event forwarding mechanism that will allow me to
"forward" events from view B to the containing view A? Or is it
admissible to simply receive a mouse event in B and kick it up to
view A by doing something like
- (void)mouseDown:(NSEvent *)theEvent {
if (needsToBeHandledByViewA) {
[superview mouseDown:theEvent];
} else { ... }
}
Even if the above code will technically work, it seems like a hack to
me, and I'd like to be able to avoid the extra method invocation
through view B in order to get to view A. Is that at all doable in
principle?
The documentation of all the - (void)mouse...:(NSEvenet*)e methods
reads: "Discussion: The default implementation simply passes this
message to the next responder." I admit I have no idea how to
interpret this? Should I somehow make the containing viewA the next
responder for view B?
Any clues?
Cheers,
-- ivan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden