• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Pop Up Menu in NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pop Up Menu in NSTableView


  • Subject: Re: Pop Up Menu in NSTableView
  • From: Quincey Morris <email@hidden>
  • Date: Sun, 24 Mar 2013 14:21:59 -0700

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

  • Follow-Ups:
    • Re: Pop Up Menu in NSTableView
      • From: Pax <email@hidden>
References: 
 >Pop Up Menu in NSTableView (From: Pascal Harris <email@hidden>)

  • Prev by Date: Re: CoreAnimation: rendering error 506
  • Next by Date: Re: Pop Up Menu in NSTableView
  • Previous by thread: Pop Up Menu in NSTableView
  • Next by thread: Re: Pop Up Menu in NSTableView
  • Index(es):
    • Date
    • Thread