On 30 Dec 2008, at 8:39 pm, Mahaboob wrote:

I'm calling this method from the action method that opens this
window. I
used the code:
- (IBAction) openMediaWindow: (id) sender
{
  [cbChooseDatabase selectItemWithTitle:@"Default table"];
  [self medialistSelectionChanged];
  [OutlineView reloadData];
  [MediaWindow makeKeyAndOrderFront:sender];
}



Not enough code here to get to the bottom of it, but can I take it you are aware that windows are loaded lazily? In other words if you have a window controller loaded from a nib, then the actual window is not instantiated until it is first shown. Therefore you can't make any calls to any objects such as views within it until it has been loaded. Thus OutlineView will be nil until the window is shown for the first time.

The window controller method - windowDidLoad: is what you need to get around that - like -awakeFromNib it can be used to do initialisation of the items in the window the first time it's shown. After that, provided the window isn't released, you can access its controls as you wish.

By the way you ought to use [NSWindowController showWindow] to make the window visible as it may be doing more that just a call to - makeKeyAndOrderFront:

hth,

Graham


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to