TableView with summary: my solution
TableView with summary: my solution
- Subject: TableView with summary: my solution
- From: Toby Sargeant <email@hidden>
- Date: Mon, 27 Jan 2003 02:37:18 +1100
Hi all,
I don't know if posting chunks of code like this is a breach of
etiquette. If it is, please say so.
Anyway, this is my solution to the problem of a summary row for
a scrolled TableView. It consists of two parts; A ScrollView
that adds a second contentView for the summary, and lays it out
with the
- (void) tile;
method, and a summary view which subclasses NSView and hijacks
parts of the table that it adds a summary for (specifically,
it uses the table's cells for drawing itself, and the table's
data source for fetching the summary information).
An example of its use would (given an appropriately changed
NSScrollView in IB) be:
- (void)
setUpSummaryForTable: (NSTableView *)master_table
{
MySummaryTableView *st =
[[[MySummaryTableView alloc]
initWithFrame: NSMakeRect(0,0,0,0)]
autorelease];
[st setMasterTable: master_table];
// the second superview of the table is the scroll view.
[((MyNSScrollView *)[[master_table superview] superview])
setSummaryDocumentView: st];
}
And then in the table data source for master_table:
- (id)
summaryObjectForColumn: (NSTableColumn *)column
{
...
}
If anyone has the time, I'd appreciate any comments, criticisms
or suggestions.
[demime 0.98b removed an attachment of type application/x-gzip which had a name of MyScrollView.tgz]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.