• 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
How to let NSPopUpButton in NSTableColumn send titleOFSelectedItem, rather than indexOfSelectedItem to the Data Source?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to let NSPopUpButton in NSTableColumn send titleOFSelectedItem, rather than indexOfSelectedItem to the Data Source?


  • Subject: How to let NSPopUpButton in NSTableColumn send titleOFSelectedItem, rather than indexOfSelectedItem to the Data Source?
  • From: Franklin Vermeulen <email@hidden>
  • Date: Mon, 24 Oct 2005 01:11:18 +0200

Hi, I am a java programmer, rather new to XCode (2 rather intensive weeks, of which 1 week w. document-based apps). There are still a few concepts that I feel uncomfortable with: "delegates", "bindings", and probably much more that I don't know of.

My current project is a Document-based Cocoa App, using a TableView with NSButtonCell's in some of the rows.
My DataSource receives a Number.
It would be much more convenient to have the Titles sent to (represented in) the data model, because for filing out, I'll convert the data model directly to xml, and I want the Strings to be in those cells, rather than the item indexes.
[
BTW, I found this to be soooo nice: it only takes a single statement for converting the data model (an NSArray of NSDictionary's, which turns out to be a plist) to xml as an NSData byte String, and another line of code for reading the NSData XML string back to the data model!
]


- I have tried to define a different NSFormatter instance, that converts a String into a String, but that doesn't seem to work.
- I tried to fool the tableViewObjectValueForLocation and tableViewSetObjectValueForLocation methods to convert the index to the corresponding String, before storing it into the data model, and vice versa, but that doesn't seem to work either. If it would work, it would be a kludge. I did have moderate success by only changing tableViewObjectValueForLocation, but then the conversion seemed to happen TWICE!
- I have been looking at objectValue and setObjectValue (subclassing NSPopUpButtonCell), but that doesn't seem to work either.
- Patching or copying the data model just before and after reading/ writing seems like a kludge as well, and far from safe:)


My question is, is there another (nice) way?

Thanks for any advice.

Franklin


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: setTextColor crash (bug in Cocoa?)
  • Next by Date: Re: Dynamically changing an application's icon / Adding a badge
  • Previous by thread: Re: setTextColor crash (bug in Cocoa?)
  • Next by thread: setFieldEditor, yes & no sort of
  • Index(es):
    • Date
    • Thread