Hi,
I recently upgraded to Xcode 2.2 and somehow lost (or better yet, could not find the proper way) myself in creating a customized instance of the window class in the IB.
What I get when I create an instance of a window is a new instance called “myWindow”. Is this the same as customWindow in previous version? I get the feeling that it could be but when I try to implement it in my studio program I get an error about the variable “myWindow” not being defined. Before, with customWiindow this variable error does not exist.
Thanks for the help.
archseed:)
Oops!
Never mind. I got it all figured out again. I simply forgot the proper steps and got also fooled by the “myWindow” default title of the window instance. I am posting here the basic steps for the benefit of the likes of me who forget easily.
Here are the steps to instantiate a new window that can be customized:
-
Click on your target window in the IB and then click on “Classes” in the “MainMenu.nib” window. You’ll will see a long list of NS objects. Select NSWindow if it is not highlighted (it should be by default).
-
Go back up to the main menu of IB and select “Instantiate NS window”. This will give you a new subclass in the “MainMenu.nib” window and by default, it is named “myWindow”. You can change that to “customWindow” if you wish.
-
With this new instance still highlighted, go back up again to the main menu of IB and select “Create file for NS window”. A new window will appear that gives you the chance to create new files “customWindow.m” and “customWindow.h”. Make sure to click the target application and save the files.
-
After you are done, you should see these two files added to the list of Xcode files at the top of your AppleScript pane.
I think that’s all there is to creating these two files. Of course, you will have to fill up these customWindow.m and customWindow.h files with program codes. That’s beyond me but Jon has a lot of demo programs you can view at his website. You can google his site easily to look at his free programs. Look especially at his “titlelessWindow” program. Very useful and enlightening, indeed!
archseed:)