• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to forward mouse events to another view?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: How to forward mouse events to another view?
      • From: Stephen Deken <email@hidden>
  • Prev by Date: Re: Core Data: undo and non-object attribute [SOLVED]
  • Next by Date: Re: Localising Preference Panes
  • Previous by thread: Re: NSImage drawAtPoint & Transparency
  • Next by thread: Re: How to forward mouse events to another view?
  • Index(es):
    • Date
    • Thread