> I'm working on an app that starts with one panel open, and no windows.
> The panel resides in the Nib file, while the windows are created by code.
> In the header:
> IBOutlet NSWindow *controlPanel; //this panel is tagged as a utility
> NSRect contentRect;
> NSWindow *fontWindow;
> FontMatrix *fontView;
> And the method that creates the window is:
> contentRect.origin.x = 40;
> contentRect.origin.y = 400;
> contentRect.size.height = 128;
> contentRect.size.width = 128;
> fontWindow = [[NSWindow alloc] initWithContentRect: contentRect
> styleMask: NSTitledWindowMask
> backing: NSBackingStoreBuffered
> defer: NO];
> [fontWindow setTitle:"128x128"];
> [fontWindow orderFrontRegardless]; //the window won't show without
> fontView = [[FontMatrix alloc] initWithFrame:[fontWindow frame]];
> [fontView drawRect:[fontView bounds]]; //all drawRect is supposed to
> do is color the view black.
> What the app is supposed to do is start with the control panel open and
> no visible windows. Menu selections should open windows and fill them
> with whatever I feel like putting in drawRect.
> What happens is that selecting a menu item only gives me an empty
> window. If I click on the window, a portion of the panel corresponding
> to the size of the window goes black.
> What's wrong is:
> 1) I have to click on the new before any drawing takes place.
> 2) The drawing takes place in the panel instead of the window.
> Any idea what I'm doing wrong?