Reputation: 57
Hi I want to run an OpenGlView in a second window. I can open this window "simualtion", but there is nothing to see, which I created in the Interface Builder. I think the problem is that I created a completely new window. I try this way, because I want to close the old window and open the new one with one and same method, because I want to use only one button. So I hope you can tell me how I can link the window from the IB. I try this way, because I want to close the old window and open the new one with one and same method, because I want to use only one button.
simulation = window = [[NSWindow alloc] initWithContentRect:NSMakeRect(100,100,700,700)
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO];
[simulation makeKeyAndOrderFront:NSApp];
Upvotes: 1
Views: 279
Reputation: 57
Hey guys I found out what was the problem:
in the interface:
#import <Cocoa/Cocoa.h>
@interface new_WatorAppDelegate : NSObject <NSApplicationDelegate> {
NSWindow *window;
NSWindow *simulation;
}
@property (assign) IBOutlet NSWindow *window;
@property (assign) IBOutlet NSWindow *simulation;
-(IBAction)runSimulation:(id)sender;
@end
in the implementation:
@synthesize window;
@synthesize simulation;
-(IBAction) runSimulation:(id)sender{
[window orderOut:self];
[simulation orderFront:self];
}
Upvotes: 1