Edit: In case someone wants to look at the actual code, here it is: http://pastie.org/713951
Long story short: the problem I'm having is I can't make the window show up in the fly() function.
Full Description:
I'm creating a plugin for the Mac application 'Coda'. I have a controller 'Bolder', with two outlets:
@class Bolder;
@interface Bolder : NSObject
{
IBOutlet id MyLabel;
IBOutlet id theWindow;
}
Coda specifies it's own init method for plugins. In this init method, I am loading a Nib 'Superman' and choosing a method 'fly' to call when my plugin is clicked:
[NSBundle loadNibNamed:@"Superman" owner:self];
[controller registerActionWithTitle:NSLocalizedString(@"OK!", @"Flying Man") target:self selector:@selector(fly:)];
In the 'fly' method, I want to show the window and change the text on a label:
- (void)fly:(id)sender
{
[theWindow orderFront:self];
[theWindow makeKeyAndOrderFront:self];
[MyLabel setStringValue:@"new text"];
}
This last bit is the part that is throwing me – the window just doesn't show up! Yet if I put these same three lines inside 'awakeFromNib' it shows up fine. What's causing this difference? I can't put this code inside awakeFromNib because that causes my plugin's window to show up every time I start Coda.