views:

31

answers:

1

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];
+1  A: 

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];
}
Marcel
To actually describe the solution: Switch from creating the window in code (and not putting any views into it) to creating the window (and views) in IB.
Peter Hosey