On Dec 14, 2004, at 2:34 PM, Alexander O'Neill wrote:
What I'm trying to do is have a GUI that is contained in multiple
layers, contained in NSViews.
So I have roughly a background layer, a content layer, and a front
layer.
The content layer and the front layer both have controls on them,
i.e., buttons, etc.
I can create them from NIB files, and swap out different NSView
objects from at each layer.
The one problem I'm having is that the topmost NSView is 'eating' all
of the mouse events that I want to go to the controls I've created on
the content layer of which the front view is a subview.
Calling setNextResponder to the content view on the front view doesn't
seem to work for me.
Is there a way to do it so taht if I don't click on a control in the
front view that the mouse event will be sent to the control that was
created as part of the content view? The button is visible, it just
doesn't respond to clicks.
Visibility has no bearing on event dispatch, as you've already found
out ;-)
Basically, when the window gets a mouse event, the responder chain will
look for the view that's deepest in the view hierarchy (ie, above all
the others) whose frame encloses the mouse location, and send that view
the event. There are a few ways that spring to mind to get the effect
you want, and the simplest is probably for you to just implement all of
your layers in a single view. You can use NSButtonCell instances
instead of NSButton, and draw them in any order you like. For event
dispatch, you'd take your incoming events and compare their locations
against your own list of where the cells appear.
A somewhat more complicated approach would be to put your various
layers in child windows, and let the window server sort out who gets
what events according to visibility. See the "RoundTransparentWindow"
example to see how to make a custom window without a title bar.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden