NSTableView class has setDataSource method that allows assign a NSTableDataSource instance to be a data source for that table view.
In v4.8 we have to add VCursorDataSource and VTableDataSource classes that are able to do this job — easy display a cursor or a table into a given NSTableView. As easy as a single line of code:
mCursorDataSource = [[VCursorDataSource alloc] initWithCursor:mCursor view:tvListBox];
This line
- creates VCursorDataSource,
- inits it by given VCursor and NSTableView
- removes from table view previous data source if it was, and all columns
- creates new columns that correspond to cursor fields with the same names
- assignes this VCursorDataSource to table view as datasource
Now table view self will fill its cells with values from cursor records.
V4CC Examples use this feature to display tables and and cursors.