Re: IB Hassle: NSButton Over NSQuickDrawView
Re: IB Hassle: NSButton Over NSQuickDrawView
- Subject: Re: IB Hassle: NSButton Over NSQuickDrawView
- From: "Louis C. Sacha" <email@hidden>
- Date: Sat, 21 Feb 2004 01:45:56 -0800
Hello...
Despite an 'Arrange In Front' menu selection - where the QDView
'seems to be in back of the button, when viewing the IB List of
objects, the QDView appears ABOVE the NSButton in the list and
there seems to be no way to get it to be BELOW.
I don't think the order in the outline view has anything to do with
the positioning of the views. As far as I know, for objects at the
same level in the heirarchy it simply reflects the order in which the
objects were created.
What you need to do is get the buttons to be subviews of the view
(see below), so that they are children of the view.
When drawing, the QDView obscures the NSButton - which does
respond to mouse clicks and is drawn until the QDView is redrawn,
where it is again obscured.
As I mentioned before (offlist), having overlapping views at a
specific point in the view heirarchy (in other words when the
overlapping views are sibling views, both subviews of the same view),
isn't guaranteed to work correctly. The effects you are describing
are the result.
Regardless of whether the QDView is in an enclosing custom view
and the button is also included in that view or if the button is
deposited into the main window and moved over the QDView, there
seems no way to get the QDView to be lower in the NIB hierarchy.
You need to make the buttons subviews of the QDView, which is
slightly more complicated than I first thought.
In my previous email, I mentioned that making the button a subview
should have happened automatically if you tried to drag an NSButton
on top of your QDView in InterfaceBuilder. I just spent a few minutes
messing around in InterfaceBuilder, and found out that this will not
work if you dragged a NSQuickDrawView from the IB pallete (the same
is true for NSMovieView and NSOpenGLView). I don't know if there is a
technical reason behind it or if it's just that the "container" code
is only implemented specifically for NSView in IB, but you can get
around this limitation fairly easily.
You can drag the normal NSView "Custom View" from the IB Pallete and
into your window instead of the NSQuickDrawView. Then just select
your QDView class in the custom class pane of the inspector, the same
way you would have done before (there are quite a few more choices,
but your QDView will be in the list).
Now, when you drag a new NSButton from the IB pallete and drop it
inside the view you just added, it will automatically become a
subview of the view. If you look at the outline view of your nib, it
should show the button as a child of your QDView.
You will have to rebuild your nib using a normal NSView to make any
QDView with buttons like this, and redo all the buttons and
connections, but when you are done, everything _should_ work and draw
correctly.
Hope that helps,
Louis
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.