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: Simone Manganelli <email@hidden>
- Date: Mon, 27 Mar 2006 15:20:16 -0800
I just tried your suggestion -- I overrode the -(BOOL)
acceptsFirstResponder method so that it always returns no. However,
it doesn't seem to pass mouse events to other views... I still can't
interact with the NSMovieView controller through this custom view.
It should be noted that I do still want this view to respond to
certain events -- specifically, the dragging and dropping of movies.
I created this custom view -- a DragProxyView -- to overcome some
problems with dragging and dropping directly into an NSMovieView.
But while the DragProxyView should accept dragged movies and should
prevent the NSMovieView from accepting dragged movies, I want the
NSMovieView to directly handle any mouse events that are supposed to
interact with the movie controller. That's why I thought that my
original idea -- to create a "hole" in the DragProxyView -- would be
the easiest way to accomplish my goal.
Any other suggestions?
-- Simone
Il giorno 2006-03-27, alle ore 14:44, Mike Abdullah ha scritto:
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