Re: Pop Up Menu in NSTableView
Re: Pop Up Menu in NSTableView
- Subject: Re: Pop Up Menu in NSTableView
- From: Pax <email@hidden>
- Date: Sun, 24 Mar 2013 21:50:36 +0000
With regard to the title to display, I was thinking of 'Activated' if actions are selected (and by clicking on the pop up one can see exactly what actions are selected), and 'Deactivated' if no selections have been made. That wording might need a little work, but that's the gist of it.
As to your second question, I've connected the "selector" connection from the cell to 'cellPreferenceChanged'. In my header I have:
IBOutlet NSPopUpButtonCell* preferenceCell;
- (IBAction)cellPreferenceChanged:(id)sender;
and both are hooked up in IB.
As to the third, how do I find out?
Thanks for taking the time to look at this!
On 24 Mar 2013, at 21:21, Quincey Morris <email@hidden> wrote:
> On Mar 24, 2013, at 13:47 , Pascal Harris <email@hidden> wrote:
>
>> Question 1. Is this possible, and am I even using the correct tool to do the job?
>
> It's certainly possible to use popup buttons in a table column.
>
> It's questionable whether this is the right tool for this job. Popup buttons aren't great at showing multiple selections -- except when their menu is actually popped up, of course. It's irritatingly harder (though not exceedingly hard) to force the button to display a title that isn't the same as the (single) selected item.
>
> And what title to display? That's a significant problem, especially if "there might be twenty [actions] in the future".
>
>> At the moment, my code looks like this (nothing is happening yet - I'm just trying to see if I can get the toggle to work - and I can't):
>> - (IBAction)cellPreferenceChanged:(id)sender
>> {
>> [[sender selectedItem] setState:NSOnState];
>> }
>>
>> cellPreferenceChanged is bound to the NSPopUpButtonCell in IB.
>
> What do you mean by "bound"? Are you using a Cocoa binding, or do you just mean you've connected the "selector" connection from the cell to some target?
>
>> Oddly, despite this binding, this code results in [NSTableView selectedItem]: unrecognized selector sent to instance. Why is this? Surely, since it is the NSPopUpButtonCell that is bound it should be the NSPopUpButtonCell instance for the selected row that is sent?
>
> I dunno, but table views do things to cells that you might not always expect. If you set a breakpoint in your 'cellPreferenceChanged' method, what does the backtrace look like?
>
_______________________________________________
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