PDA

View Full Version : Can't communicate with window


mooty
2006-07-07, 03:59
Hi all,

I've setup a document based cocoa app, with the MyDocument nib file.

The "window" outlet in the nib file is connected to my class and named as such. In my MyDocument.h file:

IBOutlet NSWindow *window;

and in my MyDocument.m click event for a button i have:

[window setTitle:@"hello world"];

I know the click event works, as I tried setting a property of a textfield and that works, but it wont communicate with my window. I've tried resizing the window with code, settings its transparency... nothing. Any ideas what I am doing wrong guys ? The app compiles fine...

chucker
2006-07-09, 00:47
1) Is your class a subclass of NSWindowController? (Doesn't technically have to be, but does make things easier.)
2) Is this your main nib file? If yes, is the class instantiated in it (do you see a blue box representing it?) If not, is the class the principal class of it (is File's Owner's class changed to be the class?)?
3) If your class is, indeed, an NSWindowController subclass, you don't need to define that outlet; there will already be an outlet named "window". Is that outlet connected to the window?

Feel free to send me a zip of your stuff and I can look over it.

Oh, finally, anything in Console?

mooty
2006-07-11, 02:53
Thanks Chucker! I actually re-visited this, and created a new outlet rather than the default "window" one already there... mainWindow works :)

chucker
2006-07-11, 03:27
Glad you figured it out.