• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
re: multiple nibs and table view (solved)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: multiple nibs and table view (solved)


  • Subject: re: multiple nibs and table view (solved)
  • From: Stephane Errante <email@hidden>
  • Date: Sun, 22 Jun 2003 17:14:43 +0200

On Vendredi, juin 20, 2003, at 19:54 Europe/Zurich, Fritz Anderson wrote:

I look at these lines in the MainController class

[NSBundle loadNibNamed:@"tableViewWindow" owner:self];
tableViewController = [[NSWindowController alloc] initWithWindow:tableViewWindow];

in connection with the tableView outlet in the tableViewController class.

I assume the tableView in question is instantiated inside tableViewWindow.nib? It does not surprise me that the tableView outlet is never initialized (is nil); nothing happens to initialize it.

Yes, you were right with your analysis on the tableView outlet. Following your suggestion, I moved it to the MainController. The tableView outlet is no longer nil. I could implement the double action method again. This is not all but at least it will keep me moving!

Thanks a lot and thanks to all who contributed,

Cheers,

Stiphane


The loadNibNamed:owner: message connects the tableView instance to the MainController class. If appropriate, the owner's (MainController's) awakeFromNib method will be called at the end of processing the loadNibNamed:owner: message. But no processing or initialization will occur in the tableViewController object, which in fact does not yet exist.

After the loadNibNamed:owner: message, the tableViewController object is created. But you do nothing (that I can see) to tell it about the tableView. It is not the owner of the tableView's nib file. It is not passed a pointer to the view. No initialization is done.

You may wish to consider making the outlet for the table a part of the controller for the window in which it appears, and use initWithWindowNibName:. That would allow you to clean up the layering of controller objects, which I think may have misled you.

-- F

On Friday, June 20, 2003, at 03:36 AM, stephane wrote:

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
}

--
Fritz Anderson - Consulting Programmer - Chicago, IL
Mail: <email@hidden>
Risumi: <http://resume.manoverboard.org>
_______________________________________________
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.

References: 
 >Re: multiple nibs and table view (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: Navigating property lists using paths?
  • Next by Date: Re: [way OT] Re: GPL and other licenses (was ANN: XML Marshalling for Objective C on OS X)
  • Previous by thread: Re: multiple nibs and table view
  • Next by thread: TrollTech releases QT for Mac under GPL
  • Index(es):
    • Date
    • Thread