Re: Multiple windows : little bit confused
Re: Multiple windows : little bit confused
- Subject: Re: Multiple windows : little bit confused
- From: Kyle Mandli <email@hidden>
- Date: Sun, 5 Aug 2001 13:56:34 -0500
If you want a simple way to have multiple nib files with windows you
should look at some code that Stiphane Sudre and Eric Peyton had put on
this list a couple of months ago (July 4th). It checks to see if the
window is already displayed, loads it if needed, and orders it front.
You have to remember to create and instance of the controller object for
the window that isn't your "main" window in the controller for the
application. Also make sure that you put the first responder in the
alternate nib file is a instance of the alternate controller class. I
hope this helps. Thanks by the way to Stiphane and Eric who helped me
on this exact problem a while back.
#import <AppKit/AppKit.h>
#import "SecondaryController.h"
@interface MainController: NSObject
{
SecondaryController * subController_;
// Add your own Outlets here
}
@end
-----
#import "MainController.h"
@implementation MainController
- (void) awakeFromNib
{
subController_=[SecondaryController alloc];
// Do your own stuff here
}
----
#import <AppKit/AppKit.h>
@interface SecondaryController : NSObject
{
IBOutlet id anOutletOfTheSecondaryWindow_;
}
- (void) showWindow;
@end
-----
#import "SecondaryController.h"
- (void) showWindow
{
if (! anOutletOfTheSecondaryWindow_)
{
if (![NSBundle loadNibNamed:@"YourSecondaryNib" owner:self])
{
NSLog(@"Failed to load YourSecondaryNib.nib");
NSBeep();
return;
}
}
[[anOutletOfTheSecondaryWindow_ window] makeKeyAndOrderFront:self];
}
@end
Kyle
On Saturday, August 4, 2001, at 05:56 AM, kubernan wrote:
Hello all !
After reading omnigroup de dev. mailing list, i'm still confused with my
app.
I have two window in this application :
- the main window in which double clicking in a row of a table view
opens a new window.
Each window are in seperate .nib files.
The doubleClick method execute this code :
if (![NSBundle loadNibNamed:@"myNibFile" owner:self]) {
NSLog(@"Failed to load Document.nib");
[self release];
}
[window makeKeyAndOrderFront:self];
I don't know if its good but myNibFile appears but...but.. nothing
happens in the .m associated
(NSBeep(); in awaikFromNib doesn't work).
At this time, the corresponding controller in .h file was defined as a
subclass of NSWindowController.
I have buttons on the window but it appears i'm not able to specify the
target in IB defined in the .m file.
The target doesn't appear in IB.
If i defined the controlleras a sublass of NSWindowController in .h
file, the target appears but after double
click for launching the window i have this message : could not connect
MyAction to the Delegate...
I'm looking for simple sample of two windows app. (the Apple example
have two much code).
Or if you have idea on my prb...
Thx for your help
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev