Skip to content

Instantly share code, notes, and snippets.

@j4johnfox
Created October 10, 2009 16:30
Show Gist options
  • Save j4johnfox/206942 to your computer and use it in GitHub Desktop.
Save j4johnfox/206942 to your computer and use it in GitHub Desktop.
// Time/Place markersTable View
var tableViewRect = CPRectCreateCopy([notesTextView frame]);
tableViewRect.origin.y += ([notesTextView frame].size.height + 10);
tableViewRect.size.width = ([containerView frame].size.width - (2 * margin));
// We want to fill the space between the bottom of the notes text view and the top of the buttons on the
// bottom of this form
var tableHeight = ([containerView frame].size.height - [createNewButton frame].size.height
- margin - 3 - tableViewRect.origin.y);
tableViewRect.size.height = tableHeight;
//log('tableViewRect is ' +CPStringFromRect(tableViewRect));
var tableScrollView = [[CPScrollView alloc] initWithFrame:tableViewRect];
[tableScrollView setAutohidesScrollers:YES];
[tableScrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[tableScrollView setHasHorizontalScroller:NO];
[containerView addSubview:tableScrollView];
timePlaceMarkersTableView = [[CPTableView alloc] initWithFrame:CGRectMake(0, 0,
([tableScrollView frame].size.width), [tableScrollView frame].size.height)];
[timePlaceMarkersTableView setDataSource:self];
[timePlaceMarkersTableView setDelegate:self];
[tableScrollView setDocumentView:timePlaceMarkersTableView];
[self configureTimePlaceMarkerTableView];
- (void)configureTimePlaceMarkerTableView
// Set up the table columns for the time place marker table view
{
var myTableColumn = nil;
myTableColumn = [[CPTableColumn alloc] initWithIdentifier:"beginDate"];
[myTableColumn setWidth:66];
[[myTableColumn headerView] setStringValue:"From:"];
[timePlaceMarkersTableView addTableColumn:myTableColumn];
myTableColumn = [[CPTableColumn alloc] initWithIdentifier:"endDate"];
[myTableColumn setWidth:66];
[[myTableColumn headerView] setStringValue:"To:"];
[timePlaceMarkersTableView addTableColumn:myTableColumn];
myTableColumn = [[CPTableColumn alloc] initWithIdentifier:"name"];
[[myTableColumn headerView] setStringValue:"Name:"];
[myTableColumn setWidth:200];
[timePlaceMarkersTableView addTableColumn:myTableColumn];
myTableColumn = [[CPTableColumn alloc] initWithIdentifier:"notes"];
[[myTableColumn headerView] setStringValue:"Description:"];
[myTableColumn setWidth:300];
[timePlaceMarkersTableView addTableColumn:myTableColumn];
var headerColor = [CPColor colorWithPatternImage:[[CPImage alloc]
initWithContentsOfFile:[[CPBundle bundleForClass:[CPTableView class]]
pathForResource:@"Aristo.blend/Resources/button-bezel-center.png"]]];
[[timePlaceMarkersTableView cornerView] setBackgroundColor:headerColor];
[[timePlaceMarkersTableView headerView] setBackgroundColor:headerColor];
[timePlaceMarkersTableView reloadData];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment