Re: NSToolbar Bug [SOLVED - At Least Partially]
Re: NSToolbar Bug [SOLVED - At Least Partially]
- Subject: Re: NSToolbar Bug [SOLVED - At Least Partially]
- From: Karl Moskowski <email@hidden>
- Date: Mon, 5 Mar 2007 18:04:18 -0500
On 05-Mar-07, at 11:25 AM, Karl Moskowski wrote:
I've observed a weird toolbar bug for which I hope someone more
versed than me in Cocoa mouse handling can offer a workaround.
I have an NSToolbar on a window with the Unified title/toolbar
look. One of the items in the toolbar is a custom view containing a
NSSlider that is initially hidden. I later programmatically show
the slider. Once the slider is visible, dragging it also annoyingly
drags the window - the window moves along with the slider's knob.
(It also happens in other draggable control types, e.g., a pop-up
button.)
The effect doesn't occur if the window doesn't have the unified
look (e.g., it's textured), or if the slider is initially visible
and I toggle its visiblity later. It also doesn't matter how the
slider is hidden - check box in IB, setHidden:YES in awakeFromNib,
Cocoa bindings hidden set to a BOOL.
I've filed a Radar bug along with a sample project. In the
meantime, as a kludgy workaround, instead of hiding the slider, I
can obscure the slider by overlaying a box the same color as the
custom view's background and hiding/showing that instead.
However, I'd like to know if there's a more elegant solution -
maybe a call to force something (the custom view? the window?) to
correctly track the mouse.
In case anyone runs into this in the future, I've found a more
appealing (and simple) solution than overlaying another view and
controlling its visibility. However, it's probably not appropriate
for all situations. In my custom view's class, I've overridden the
method mouseDownCanMoveWindow to return NO.
That means none of the view can be used to drag the window, including
any pesky controls it contains. It works in my case because I fill
the view with a background color, and it visually appears distinct
from the title/toolbar area. In other instances, such as when the
view's background is transparent so its controls simply appear as
part of the toolbar, it may not be a viable solution.
--Karl <email@hidden>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden