• 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: NSPopUpButtonCell -- I need an outlet to gain access to the button
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPopUpButtonCell -- I need an outlet to gain access to the button


  • Subject: Re: NSPopUpButtonCell -- I need an outlet to gain access to the button
  • From: "I. Savant" <email@hidden>
  • Date: Wed, 16 May 2007 13:54:34 -0400

Dalton:

My objective is to give the user three possible choses in a table
column.  So, I'd like to simply provide a popup type button that
provides the valid options for them to chose from.  If you think I
should do this another way, please let me know -- I've only got a
couple days into the code at this point.

While I understand you have a time constraint, with respect, it has nothing to do with getting your problem solved. :-) I wasn't suggesting not using a popup button, but if you're allowing users to edit cells that are in a row in a table view, -tableView:setObjectValue:forTableColumn:row: *is* how it's done.

 It works generally the same way for setting an object's attribute
based on a selection in a popup as it does for setting a string in a
normal text field cell.

 See:
  http://www.cocoadev.com/index.pl?NSTableViewTutorial
  http://www.cocoadev.com/index.pl?AnotherNSTableViewTutorial

 Given your description, the above links *are* the solution to your
problem. This is exactly what you need to do, with a slight
modification / consideration since the "object" handed to you in
-tableView:setObjectValue:forTableColumn:row: may not be exactly what
you expect. Just set a breakpoint in that method and examine the
"object" the popup is handing you to make sure it's what you're
expecting. You'll figure it out.

As for Bindings, I've never used them.  I've taught myself Cocoa a
few years back and all the examples and samples I taught myself with
were this model -- i.e. not Bindings.

Then you're using the NSTableViewDatasource methods. I suggest reading the articles above and searching the documentation for "NSTableViewDatasource". Whether you only have a few days or not, you still have to do it right ... best to just take the time to read the manual before wasting days barking up the wrong tree (in the wrong forest).

I've read a few articles regarding Bindings and they seem much faster
but also for the person who isn't an expert and someone working and
teaching themselves as they write apps for various reasons, Bindings
can be much harder to debug -- or it looks that way.

I'm curious to know what article you're referring to regarding the "person who isn't an expert" part. This is completely incorrect. Cocoa Bindings relies on several other "moderate" to "advanced" Cocoa skills like Key Value Coding and Key Value Observing. These topics are not for Cocoa newbies.

 Bindings *can* be hard to debug, yes, but knowing the technology
(and its supporting technologies) well will avoid most of the
hard-to-debug problems. Bindings and KVO can eliminate a lot of
glue-code, but they're not a solution to everything (in fact they're
rather counterintuitive in some situations). Either way, that's
irrelevant for your particular problem since you're not using
Bindings. :-)

If I wanted to start moving toward "Bindings" do you have a
recommendation of where I should start?  Doing a quick search on how
to use NSPopUpButtonCell with Bindings, I found the following URL:
http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaBindings/Tasks/onerelation.html
I'll give it a try.

http://www.cocoadevcentral.com http://homepage.mac.com/mmalc/CocoaExamples/controllers.html

--
I.S.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: NSPopUpButtonCell -- I need an outlet to gain access to the button
      • From: Dalton Hamilton <email@hidden>
    • Re: NSPopUpButtonCell -- I need an outlet to gain access to the button
      • From: "I. Savant" <email@hidden>
References: 
 >NSPopUpButtonCell -- I need an outlet to gain access to the button (From: Dalton Hamilton <email@hidden>)
 >Re: NSPopUpButtonCell -- I need an outlet to gain access to the button (From: "I. Savant" <email@hidden>)
 >Re: NSPopUpButtonCell -- I need an outlet to gain access to the button (From: Dalton Hamilton <email@hidden>)

  • Prev by Date: Re: NSPopUpButtonCell -- I need an outlet to gain access to the button
  • Next by Date: Re: NSPopUpButtonCell -- I need an outlet to gain access to the button
  • Previous by thread: Re: NSPopUpButtonCell -- I need an outlet to gain access to the button
  • Next by thread: Re: NSPopUpButtonCell -- I need an outlet to gain access to the button
  • Index(es):
    • Date
    • Thread