Re: CustomView that forwards mouse events to lower views?
Re: CustomView that forwards mouse events to lower views?
- Subject: Re: CustomView that forwards mouse events to lower views?
- From: Mike Abdullah <email@hidden>
- Date: Mon, 27 Mar 2006 23:44:20 +0100
I believe that if you set your custom view to not accept first
responder status, then any events that it would normally handle are
passed up the chain to the superview.
Somebody please correct me if I am wrong!
Mike.
On 26 Mar 2006, at 13:12, Simone Manganelli wrote:
I'm trying to create a view that has a custom shape, so that mouse
events get "forwarded" to views that are behind this custom view.
(I say "forwarded" in quotes, because if events are outside this
weird-shaped view, events won't even get passed through this
view.) Specifically, I have an NSMovieView in my interface, with
an NSCustomView that covers the whole window. However, I'd still
like users to be able to directly use the NSMovieView controller --
they should be able to drag the slider to a position, click the
play/pause button, and use the step forward and step back buttons.
I don't want to programatically forward these events, though, so I
figured that I could create a custom view that has a hole where the
NSMovieView's controller is. That way, mouse events in that area
would be directly passed to the NSMovieView, without any intervention.
The FunkyOverlayWindow sample project from Apple's developer site
( http://developer.apple.com/samplecode/FunkyOverlayWindow/
FunkyOverlayWindow.html ), seems to provide a way to do this for
windows. Specifically, a window is created containing a single
NSView that covers the whole view of the window. The window is set
to be non-opaque, and then you can color the NSView with various
colors so that it becomes a custom window. You can also use a
clearColor to create a hole in the view, which effectively creates
a hole in the window -- you can click in the hole, and the window
behind the overlay window will be brought to the front instead.
It seems to accomplish this by overriding the -(void)drawRect:
(NSRect)rect method of an NSView. However, if I do this for the
custom view that sits atop my NSMovieView, it seems to instead
paint black over the parts that I specified to be clear, and mouse
events are not passed to the NSMovieView -- they are still
intercepted by my custom view.
Any suggestions?
-- Simone
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_______________________________________________
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