multiple nibs and table view
multiple nibs and table view
- Subject: multiple nibs and table view
- From: stephane <email@hidden>
- Date: Fri, 20 Jun 2003 10:36:53 +0200
Hello,
I am working on an application (first project) which is not document
based and uses mulitple nibs. Multiple nibs are used for two functional
reasons:
- to let users input data that will be integrated into a table view in
the main menu nib;
- to retrieve recurring data from table views to ease input of data;
I developed a prototype of a table view (based on several
documentation: "Learning Cocoa", "Cocoa Programming",o'reilly
examples,...). This table view allows to add data, delete data and
return selected row values when double clicked (modification of data
not yet implemented). The data is stored in a file and uses mutable
array.
Now the issue is when I integrate this prototype into my application, I
can load the table view from the main menu nib but most of
functionalities are gone: I cannot delete records and set double click
action. I still can add records but the refresh method is working only
when I click on the row that will contain the new data! I notice in the
awake nib method that the table view value is "null" whereas in the
prototype this value is never null (see highlight below). No matter
what I tried to do, this value remains null. This lets me think that I
am missing something fundamental and haven't been able to find it out
till now.
So any help/hint/direction greatly appreciated (I have thoroughly read
all possible info I could find on lists and doc but none brought to
light...).
Here is some detail of the implementation
MainController.h
@class tableViewController;
@interface MainController : NSObject
...
--------
MainController.m
- (IBAction)openTableView:(id)sender
{
if (!tableViewController) {
[NSBundle loadNibNamed:@"tableViewWindow" owner:self];
tableViewController = [[NSWindowController alloc]
initWithWindow:tableViewWindow];
}
[tableViewController showWindow:self];
}
----------
tableViewController.h
#import <Cocoa/Cocoa.h>
#import <MainController.h>
@interface tableViewController : NSObject
{
IBOutlet id tableView;
}
- (void)awakeFromNib;
---------
tableViewController.m
- (void)awakeFromNib
{
...
[tableView setDoubleAction:@selector(myDoubleClick:)];
[tableView setTarget:self];
NSLog(@" %d ",tableView); //always returns null whereas in
prototype not
}
....
- (void)myDoubleClick:(id)sender
{
NSLog(@"test double click"); // never gets called
id theRecord;
if ([tableView selectedRow] < 0) //in case click outside of
filled in rows
return;
theRecord = [records objectAtIndex:[tableView selectedRow]];
[dataTest setStringValue:[theRecord objectForKey:@"test"]];
}
_______________________________________________
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.