Re: NSTableView updating checkboxes
Re: NSTableView updating checkboxes
- Subject: Re: NSTableView updating checkboxes
- From: Jo Phils <email@hidden>
- Date: Wed, 25 Mar 2009 00:51:47 -0700 (PDT)
Hi Michael and Graham,
Thank you both for your replies and time...sorry for my delay. You have been most helpful and even though I'm still working on it I believe you have given me enough info and understanding to get it to do what I need. There might be some issues with other parts of my code as well so I'm trying to clean it all up so that my Table View will be ok. I have flagged your messages for reference and I'll let you know how it works out...and I very much appreciate the help! :-)
Sincerely,
Rick
________________________________
From: Michael Vannorsdel <email@hidden>
To: Jo Phils <email@hidden>
Sent: Monday, March 23, 2009 10:35:31 AM
Subject: Re: NSTableView updating checkboxes
Just remember that every time the table view redisplays itself (for whatever reason), it will rebuild the list by asking the data source again how many rows there are by calling numberOfRowsInTableView:, then it will ask the value of each column of each row (that's visible) with tableView:objectValueForTableColumn:row:. For checkboxes you return NSNumbers with NSOnState or NSOffState. For text boxes you'd return NSStrings and image boxes NSImages. When the user edits a row and column (by checking or unchecking a box, changing text), tableView:setObjectValue:forTableColumn:row: of your data source is called with the objectValue being a new NSNumber for checkboxes with the new state, or a new NSString for the new text, ect. So you update your array with the new updated value.
To initialize default values do it in the data source's init method. And whenever you change the contents of your data source always call the table view's reloadData method to let it know it needs to redisplay (and rebuild) itself at the soonest opportunity.
On Mar 22, 2009, at 7:21 PM, Jo Phils wrote:
> Thank you Andrew (and Graham),
>
> I think i'm finally realizing that! :-) Thank you very much. Ok I still don't have it yet but it's back to work for me and hopefully the next time I post back I'll finally have it... :-)
_______________________________________________
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