Re: Problems with NSPathControl
Re: Problems with NSPathControl
- Subject: Re: Problems with NSPathControl
- From: Dave DeLong <email@hidden>
- Date: Mon, 12 Jul 2010 15:26:43 -0600
OK, not a bad idea. However, even if I have the menu, I'm still going to have to somehow map the menuitems to the NSPathComponentCells to get the URL, because the NSMenuItems don't have their representedObject set to anything. So I'm going to have to map a menuitem to a file URL. OK, this shouldn't be too bad. Just another gotcha though is that the list of menuitems is in the opposite order as the array of pathComponentCells.
I think I'm just going to modify the menuItems. Since I have to access stuff directly in order to figure out which pathComponentCell's URL I need, I might as well make it easy and avoid another instance variable on my controller.
Thanks, Kevin!
Dave
On Jul 12, 2010, at 3:12 PM, Kevin Perry wrote:
> Yeah, this is an unfortunate bug that we didn't catch until Snow Leopard.
>
> Here's one way to work around it (there may be a better alternative that I'm not aware of). You can implement pathControl:willPopUpMenu: and keep a pointer to the menu it gives you. When the action is called, -[NSMenu highlightedItem] should give you the NSMenuItem that was selected. No need to modify the menu items' targets or actions.
>
> On Jul 12, 2010, at 1:50 PM, Dave DeLong wrote:
>
>> Or do I have to do something wonky like altering the target/action of menuitems before they show up?
>>
>> Dave
>>
>> On Jul 12, 2010, at 2:45 PM, Dave DeLong wrote:
>>
>>> Fair enough; How can I retrieve which item was clicked? The sender of the action is the actual NSPathControl, and -clickedPathComponentCell:, which works on 10.6, returns nil on 10.5.
>>>
>>> Dave
>>>
>>> On Jul 12, 2010, at 2:39 PM, Kevin Perry wrote:
>>>
>>>> Dave,
>>>>
>>>> I believe what you're seeing is the intended behavior.
>>>>
>>>> There are cases where developers have not wanted the URL to change when an item in the pop-up menu is selected. Instead of doing this automatically and forcing developers to prevent or undo this behavior, NSPathControl instead expects you to set URL yourself in the action method if you want this behavior.
>>> _______________________________________________
>>>
>>> Cocoa-dev mailing list (email@hidden)
>>>
>>> Please 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
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please 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
>
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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