Re: Dragging to NSToolbar
Re: Dragging to NSToolbar
- Subject: Re: Dragging to NSToolbar
- From: j o a r <email@hidden>
- Date: Fri, 11 Jan 2002 07:26:03 +0100
On Friday, January 11, 2002, at 02:14 , Steve Gehrman wrote:
I would like to drag items to my NSToolbar without having to bring up
the customization window. Basically I want to emulate the Finder and
be able to drag and drop files and folders into my toolbar.
I don't see a way of doing this in the current NSToolbar API, is there
an undocumented way of doing this?
If you check more closely you'll see that the Finder has a very, very,
custom implementation of it's toolbar (it's not even using a sheet for
the configuration panel). I guess being a Carbon app forced them to roll
their own version early on.
I have worked pretty extensively with toolbars lately and haven't found
anything to indicate that you could do what you're asking for. Two
reasons: First of all I'm not even sure that the toolbar is listening
for drag events when the sheet is not running. Second, the toolbar seems
to verify that the new item being dropped on it originates from either
the configuration sheet or from "within itself" - ie. it doesn't even
accept dragged items from other toolbars of the same toolbar family.
There are a couple of private methods in NSToolbar that you could have a
look at if you'd like to hack your way around this limitation, I have no
idea if this could provide a workable solution though:
- (void)_setCustomizesAlwaysOnClickAndDrag:(char)fp12;
- (char)_customizesAlwaysOnClickAndDrag;
You already know that working with private methods is not recomended,
they are likely to change, produce unwanted side-effects, etc., etc.
j o a r