Programmatically creating an NSTableView (trouble getting the NSHeaderView to show up)(cocoa osx)

Here is some code to programmatically create a table view with a scroll bar, and multiple columns. // create a table view and a scroll view NSScrollView * tableContainer = [[NSScrollView alloc] initWithFrame:NSMakeRect(10, 10, 380, 200)]; NSTableView * tableView = [[NSTableView alloc] initWithFrame:NSMakeRect(0, 0, 364, 200)]; // create columns for our table NSTableColumn * column1 … Read more

Selecting A Row In An NSTableView Programmatically

Joshua, make sure to use the developers documentation to determine whether or not it’s a delegate method. If it were a delegate method, it would be mentioned in the docs for NSTableViewDelegate. What you’re looking for is very straight forward. Objective-C NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:1]; [tableview selectRowIndexes:indexSet byExtendingSelection:NO]; Swift 2 let indexSet = NSIndexSet(index: … Read more

Change selection color on view-based NSTableView

Since you’re using the view based NSTableView, you can subclass NSTableRowView, feed it to the table delegate method – (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row;, then customize your selection in the row view class. Here’s an example: – (void)drawSelectionInRect:(NSRect)dirtyRect { if (self.selectionHighlightStyle != NSTableViewSelectionHighlightStyleNone) { NSRect selectionRect = NSInsetRect(self.bounds, 2.5, 2.5); [[NSColor colorWithCalibratedWhite:.65 alpha:1.0] setStroke]; [[NSColor colorWithCalibratedWhite:.82 … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)