• 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: Implementing a Slightly Unusual NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Implementing a Slightly Unusual NSTableView


  • Subject: Re: Implementing a Slightly Unusual NSTableView
  • From: Graham Cox <email@hidden>
  • Date: Mon, 21 Apr 2008 00:36:04 +1000

I just noticed a bug in the code I posted - it should be:

- mouseDown:
...

if ([dataCell trackMouse:event inRect:cellFrame ofView:self untilMouseUp:YES])
{
// call the datasource to handle the checkbox state change as normal
[[self dataSource] tableView:self setObjectValue:[dataCell objectValue] forTableColumn:theColumn row:row];
}
...



previously I passed dataCell directly, not [datacell objectValue], and I passed it to the delegate, not the dataSource.


In fact passing <dataCell> works with many cell types such as buttons and checkboxes because they happen to implement methods such as stringValue and so on, but if you use a custom cell that returns something like a colour for example, that doesn't work. The delegate/ datasource mixup is another thing I got away with as usually they happen to be the same.

To be honest I'm having to sort of guess how the tableview is actually calling its dataSource, so this could still be wrong, but so far this handles all the cases I've thrown at it (admittedly not that many, but includes a variety of standard and custom cells).

G.
_______________________________________________

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: Implementing a Slightly Unusual NSTableView
      • From: Peter Zegelin <email@hidden>
References: 
 >Implementing a Slightly Unusual NSTableView (From: Peter Zegelin <email@hidden>)
 >Re: Implementing a Slightly Unusual NSTableView (From: Graham Cox <email@hidden>)
 >Re: Implementing a Slightly Unusual NSTableView (From: Peter Zegelin <email@hidden>)
 >Re: Implementing a Slightly Unusual NSTableView (From: Graham Cox <email@hidden>)
 >Re: Implementing a Slightly Unusual NSTableView (From: Peter Zegelin <email@hidden>)

  • Prev by Date: Re: NSPopupButton Bindings
  • Next by Date: Re: Get list of possible applications
  • Previous by thread: Re: Implementing a Slightly Unusual NSTableView
  • Next by thread: Re: Implementing a Slightly Unusual NSTableView
  • Index(es):
    • Date
    • Thread