• 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: NSTableView & different columns
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView & different columns


  • Subject: Re: NSTableView & different columns
  • From: Jerry Krinock <email@hidden>
  • Date: Sat, 02 Jul 2005 11:17:39 -0700

on 05/07/02 09:37, Sanri Parov at email@hidden wrote:

> As far as I don't really understand the difference between

Both of these are delegate methods in the NSSTableDataSource protocol.  The
OS calls your implementation of them.  The first one is used for data output
to the user, the second is for data input from the user.

> - (id)tableView:(NSTableView *)aTableView
> objectValueForTableColumn:(NSTableColumn *)aTableColumn
> row:(int)rowIndex

The OS calls the above method when it wants to draw a particular cell.  You
must implement this method to give it back the correct data.

> - (void)tableView:(NSTableView *)aTableView setObjectValue:anObject
> forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex

The above method is called by the OS when the user edits your table, to give
you the new data.  If your table is not editable, you don't need to
implement this method.

> I'm stuck with this problem: I can't write TableViews.
> What I'm trying to do is: in the first column (NSTextCell) set the
> value of rowIndex, while in the second one (NSButtonCell) set the cell
> on or off if I encounter certain conditions.

You use that first method for both of these, passing the appropriate
aTableColumn identifier in each case.

To get these identifiers, you send the message -tableColumns to your
NSTableView.  This can be done in your window controller's -awakeFromNib
implementation.  You will get back an NSArray of two NSTableColumns.

It's confusing to beginners because we expect table columns to be identified
with simple integer indices like the rows are.

Read in your ADC Reference Library > Documentation > Cocoa > User Experience
> Controls and Cells > Table Views.


 _______________________________________________
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

  • Follow-Ups:
    • Re: NSTableView & different columns
      • From: Sanri Parov <email@hidden>
References: 
 >NSTableView & different columns (From: Sanri Parov <email@hidden>)

  • Prev by Date: Re: Hotkey in Cocoa (not using carbon).
  • Next by Date: Re: NSTableView & different columns
  • Previous by thread: NSTableView & different columns
  • Next by thread: Re: NSTableView & different columns
  • Index(es):
    • Date
    • Thread