Actions and windows

Discussion in 'Mac Programming' started by silentnosie, May 27, 2009.

  1. macrumors newbie

    Joined:
    May 27, 2009
    #1
    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?
     
  2. macrumors 6502a

    Joined:
    Oct 13, 2007
    #2
    The behavior you want from NSWindow is '-close'. Objective-C (like C) is case-sensitive, so '-close' and '-Close' are different things.
     
  3. thread starter macrumors newbie

    Joined:
    May 27, 2009
    #3
    stuff

    Okay I changed Close to close, it's sending the text still, but the panel window refuses to close.
     
  4. thread starter macrumors newbie

    Joined:
    May 27, 2009
    #4
    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
     
  5. thread starter macrumors newbie

    Joined:
    May 27, 2009
    #5
    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.
     

Share This Page