A TableView is created in IB, and it is desired that it have only one column with checkboxes. One way to create the checkboxes is to drag an NSButtonCell into the column using IB, and then conforming to the NSTableViewDataSource protocol implement:
- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView
Hence when a class object is acting as a datasource to a column in a TableView, and the column contains objects such as checkboxes for each row, is the class supplying the only the on/off state data for the checkboxes, or is it also supplying the checkbox objects?
Related questions are:
- Is the TableView creating and containing the NSButtonCells?
- If the answer to 1 is yes, how can one set/change the NSButtonCell's properties, like its title?
- Rather than the TableView creating and maintaining the NSButtonCells, can the datasource class create them? That is, instead of using IB to drag the NSButtonCell to the column, can one add the NSButtonCells in a method such as awakeFromNIB?
- Is there a way to mix the types of cell objects in a given column. For example, could one have a text heading in column1row1 followed by a checkbox in column1row2?
Thanks.