Thank you eddie and kainjow. Problem solved
_______________
I am trying to create an example of an NSTableView implementation.
The Xib file contains 1 table view, 1 text field, and 1 button appropriately connected. The app compiles and launches. Using breakpoints I have found that the array does indeed record data for every time you click the button, however the TableView specific methods never run. Any ideas?
Thanks so much for all of your help, past and present,
Whit
TableViewController.h
TableViewController.m
_______________
I am trying to create an example of an NSTableView implementation.
The Xib file contains 1 table view, 1 text field, and 1 button appropriately connected. The app compiles and launches. Using breakpoints I have found that the array does indeed record data for every time you click the button, however the TableView specific methods never run. Any ideas?
Thanks so much for all of your help, past and present,
Whit
TableViewController.h
Code:
#import <Cocoa/Cocoa.h>
@interface TableViewController : NSObject/* Specify a superclass (eg: NSObject or NSView) */ {
IBOutlet NSTableView *tvTable;
IBOutlet NSTextField *txtTexToAdd;
NSMutableArray *arrayOfText;
}
- (IBAction)btnAdd_Click:(id)sender;
- (int)numberOfRowsInTableView:(NSTableView *)tableView;
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex;
@end
TableViewController.m
Code:
#import "TableViewController.h"
@implementation TableViewController
- (id) init
{
if (self = [super init])
{
arrayOfText = [[NSMutableArray alloc] init];
}
return (self);
}
- (void) dealloc
{
[arrayOfText release];
[super dealloc];
}
- (IBAction)btnAdd_Click:(id)sender
{
NSString *textToAdd = [txtTexToAdd stringValue];
[arrayOfText addObject:textToAdd];
[tvTable reloadData];
}
- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView
{
return [arrayOfText count];
}
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
NSString *valueToDisplay = [arrayOfText objectAtIndex:rowIndex];
return valueToDisplay;
}
@end