Re: NSPathControl w/ popups and icons
Re: NSPathControl w/ popups and icons
- Subject: Re: NSPathControl w/ popups and icons
- From: Kevin Perry <email@hidden>
- Date: Mon, 9 Aug 2010 07:28:00 -0700
NSPathControl doesn't map submenus in its menu to the individual NSPathComponentCells, so that's not going to work.
This will probably require some heavy subclassing of at least NSPathComponentCell, and perhaps NSPathCell (if the layout isn't quite how you need it). You'll need to provide some way to set a menu on your component cell, and you'll also need to override cell mouse tracking so you can show the menu when the user clicks on the cell. That might be enough, but depending on your expectations, you may need to do more than that.
On Jul 31, 2010, at 5:44 PM, Shane wrote:
> I'm trying to create an NSPathControl where there are several items
> (components) within the row and each item (component) is a popup menu.
> And then I would populate each of those popups w/ items. But I'm
> having a problem in understanding if that's how it really works.
>
> I'm playing around w/ the following code. Can anyone offer guidance on
> using NSPathControl?
>
>
> NSPathComponentCell *cell1 = [[NSPathComponentCell alloc] init];
> [cell1 setTitle:@"cell 1"];
> [networkComponents addObject:cell1];
>
> NSPathComponentCell *cell2 = [[NSPathComponentCell alloc] init];
> [cell2 setTitle:@"cell 2"];
> [networkComponents addObject:cell2];
>
> NSMenu *pathMenu = [[NSMenu alloc] initWithTitle:@"Main"];
> NSMenuItem *pathItems = [[NSMenuItem alloc] initWithTitle:@"item #1"
> action:nil keyEquivalent:@""];
> NSMenuItem *pathItems2 = [[NSMenuItem alloc] initWithTitle:@"item #2"
> action:nil keyEquivalent:@""];
> [pathItems setSubmenu:pathMenu];
> [pathItems2 setSubmenu:pathMenu];
>
> [networkPathControl setMenu:pathMenu];
>
> // setStringValue works, but its' only 1 single popup that's empty unless
> // I click on it, then I see the string values
> //[networkPathControl setStringValue:@"cell 3 / cell 4"];
>
> //[networkPathControl setPathComponentCells:networkComponents];
> //[networkPathControl setBackgroundColor:[NSColor blueColor]];
> //[networkPathControl setNeedsDisplay:YES];
> _______________________________________________
>
> 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