• 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: connections and the nib lifecycle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: connections and the nib lifecycle


  • Subject: Re: connections and the nib lifecycle
  • From: Vijay Malhan <email@hidden>
  • Date: Wed, 21 May 2008 22:51:05 +0530

Are you on Leopard?
This behavior should not be there on Tiger.
I faced similar problem on Leopard with NSTableView. It seems in Leopard, nib is loaded, with lazy-loading kind of approach. The controls are not initialized until the window, on which the controls are hosted, is not referenced.


If you'll put a [self window] call just before the first NSLog, your code might work.
- (void) test:(NSString*)string
{
   [self window];
   [textField setStringValue:string];

   NSLog(@"textField=%@", textField);

   int ret = [NSApp runModalForWindow:[self window]];

NSLog(@"textField=%@", textField);
    }

Let me know if this works.

- Vijay




On 21-May-08, at 9:35 PM, Torsten Curdt wrote:

I have a class that extends NSWindowController. I instantiate and call it like this

 MyWindowController *controller = [[MyWindowController alloc] init];
 [controller test:@"test"];

The NIB has the textField connected. Here is the (simplified) implementation of the controller.

- (id) init
{
   self = [super initWithWindowNibName:@"SomeOther"];
   return self;
}

- (void) awakeFromNib
{
   NSLog(@"nib loaded.");
}

- (void) windowDidLoad
{
   NSLog(@"window loaded.");
}

- (void) test:(NSString*)string
{
   [textField setStringValue:string];

   NSLog(@"textField=%@", textField);

   int ret = [NSApp runModalForWindow:[self window]];

   NSLog(@"textField=%@", textField);


Looking into the test method. Why on earth is the textField nil first and only after the runModalForWindow holds the proper reference??
I've already gotten the awakeFromNib and even the windowDidLoad message!


I am confused. Any wise words?

cheers
--
Torsten
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: connections and the nib lifecycle
      • From: Torsten Curdt <email@hidden>
    • Re: connections and the nib lifecycle
      • From: Torsten Curdt <email@hidden>
References: 
 >connections and the nib lifecycle (From: Torsten Curdt <email@hidden>)

  • Prev by Date: Re: Trying to understand -- please help...
  • Next by Date: Re: Trying to understand -- please help...
  • Previous by thread: connections and the nib lifecycle
  • Next by thread: Re: connections and the nib lifecycle
  • Index(es):
    • Date
    • Thread