• 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: Connecting lots of fields
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Connecting lots of fields


  • Subject: Re: Connecting lots of fields
  • From: mmalcolm crawford <email@hidden>
  • Date: Tue, 2 Dec 2003 15:12:39 -0800

On Dec 2, 2003, at 2:27 PM, Bjvrn Carlstrvm wrote:
A bit of a newbie question maybe. I'm having an object that serves as a datasource for a tableview. The datasource basically contains an array of records. I now want to display detailed information about the selected record in a view using several textfields. This seems like something thats probably been done a zillion times but I can't find an example in any of my books. How do I set it up in IB? Do I have to create an outlet in my dataSource for each of the fields of my record and fill them with the right information each time the user selects a different record, or is there an easier way?

That's the traditional way. You'd set a delegate for your tableview (typically the same object as the datasource) and implement:
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
When the selection changes, you update all the text fields accordingly.

Can I connect all my NSTextFields to my dataSource and have a methiod returning a value depending on which NSTextField called the method?

If you mean what I think you mean, no. In fact the reverse. You typically have to connect your text fields to action methods to inform the datasource that a value has changed. (You then have to determine which record has been changed, usually by sending the tableview a -selectedRow message to get the index of your object in the array...

I believe I'm looking for something with the same simplicity as I have when setting up an NSTableVIew with its different columns?

If you're using Panther, you might consider using the controller layer technology...
<http://developer.apple.com/documentation/Cocoa/Conceptual/ ControllerLayer/index.html>

See also some examples at:
<http://homepage.mac.com/mmalc/CocoaExamples/controllers.html>

If you choose this latter route, I would be very interested to know how you get on. My gut feeling is that users should know more than you appear to at the moment (a simple observation, no offense intended) before they start using this (the controller layer) technology. Perhaps you might care to prove me wrong!

mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Connecting lots of fields (From: Björn Carlström <email@hidden>)

  • Prev by Date: Re: Strange NSStatusItem Bug
  • Next by Date: Re: makeWindowControllers question
  • Previous by thread: Connecting lots of fields
  • Next by thread: Re: Connecting lots of fields
  • Index(es):
    • Date
    • Thread