Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

silentnosie

macrumors newbie
Original poster
May 27, 2009
6
0
For the time being I'm dealing with two separate windows(one is a panel) in Xcode3.

I have one button on the panel window that sends text to a text field on window one. I would like to have the panel close and a new panel open when I push the button, while sending text still.

My controller.h file I have:
Code:
#import <Cocoa/Cocoa.h>

@interface Domaintest : NSObject {
    IBOutlet id display;
	IBOutlet NSPanel* Domain01;
}
- (IBAction)click:(id)sender;
@end
I named the file Domain01 in IB under Identity tab on the Name field not the Class one or anywhere else

For my controller.m file i have:

Code:
#import "Domaintest.h"

@implementation Domaintest
- (IBAction)click:(id)sender {
	[display setStringValue:@"Domain Test"];
   	[Domain01 Close];
 
}
@end

The button is sending the text just fine but it's not closing the window. When I build I get two warning (yellow color) that NSPanel may bot respond to '-Close'.

Anybody have any suggestion on how to fix or do this another way?
 
The behavior you want from NSWindow is '-close'. Objective-C (like C) is case-sensitive, so '-close' and '-Close' are different things.
 
stuff

Okay I changed Close to close, it's sending the text still, but the panel window refuses to close.
 
stuff

cool beans man, got it to work. I started at test project and forgot to rename the panel to Domain01.

What would I use to get another window opened

Code:
#import "tester.h"

@implementation tester
- (IBAction)click:(id)sender {
	[display setStringValue:@"Domain Test"];
   	[Domain01 close];
	[Domain02 open];
}
@end

sorry been a few years since I did any type of programing and some stuff I just don't remember or never tried
 
stuff

lol well this came back to me also right after I posted.

Got it working with
Code:
#import "tester.h"

@implementation tester
- (IBAction)click:(id)sender {
	[display setStringValue:@"Domain Test"];
   	[Domain01 close];
	[Domain02 orderFront:self];
}
@end

man I never thought I would forget this crap, but it's coming back slowly. Thanks again for your help man.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.