Newbie Question: NSTableView.DataSource
Newbie Question: NSTableView.DataSource
- Subject: Newbie Question: NSTableView.DataSource
- From: William Jamieson <email@hidden>
- Date: Fri, 11 May 2001 10:56:27 +1000
Hello All!!!
I am building a Cocoa Java application that requires the use and
manipulation of table data. I have created a NSTableView with four columns
(the easy part!!!).
The documentation available tells me (as I understand it) that I need to
create an object to connect to the NSTableView as its DataSource (hence
NSTableView.DataSource) and that this object requires 3 methods (2 if the
table data is not editable). These are:
NumberOfRowsInTableView()
TableViewObjectValueForLocation()
TableViewSetObjectValueForLocation() -- Required for editing data
What I don't understand (in my infinite lack of wisdom) is what kind of
object I can/should connect to the NSTableView as its DataSource. To this
effect I have 5 main questions:
1. Should the DataSource object be a SubClass of NSMutableArray which is an
array of arrays (an array of rows)?
2. Do I need to instantiate the object attached as the NSTableView's
DataSource (whatever kind of object it is)?
3. Can the object connected as the NSTableView's DataSource be my main
controller class for the application?
4. What is the best way to implement the 3 methods mentioned above?
5. Should the dataSource object be the same as the delegate object for the
NSTableView? What are the problems/benefits in doing this?
If anyone has a working knock-up example of a project using a NSTableView
that can handle adding and deleting Table Rows could they please point me to
it so I can pull it apart and see how it ticks?
Thanks again for your time and support
Regards
William Jamieson
Systems Developer
Smart Works Systems
_____________________________________________________________
113 Ferrars St Phone: 03) 9696 6851
Southbank Fax: 03) 9690 0092
VIC 3006 Mobile: 0412 715 735
Australia Email: email@hidden
WWW:
http://www.smartworks.com.au/
_____________________________________________________________