Your implementation of init is wrong. You are returning nil which means that initialization failed.

You should be doing something like:
- (id) initWithContentRect: (NSRect) contentRect
                 styleMask: (NSUInteger) windowStyle
                   backing: (NSBackingStoreType) bufferingType
                     defer: (BOOL) deferCreation
{
        ...
self = [super initWithContentRect: contentRect styleMask: windowStyle backing: bufferingType defer: deferCreation];
        if (nil == self)
                return self;

        ...
    return (self);
}


On Mar 12, 2009, at 4:41 PM, vinai wrote:

Hi,

The complete code for the object is attached. I guess I am still more than a little perplexed why the window itself is being drawn fine, but I can't get any elements (like the text field) drawn to the panel view.

Thanks

--- On Thu, 3/12/09, I. Savant <idiotsavant2...@gmail.com> wrote:

From: I. Savant <idiotsavant2...@gmail.com>
Subject: Re: code for drawing an NSTextField to a panel window ...
To: for_use...@yahoo.com
Cc: Cocoa-dev@lists.apple.com
Date: Thursday, March 12, 2009, 12:00 PM
On Wed, Mar 11, 2009 at 12:11 PM, vinai
<for_use...@yahoo.com> wrote:

where rawButtonRect is an NSRect, contectRect defines
the panel window I am trying to draw to, and rawTextField is
of * NSTextField type.  mainPanelView is the view for the
mainPanel window, and rawTextField is just one of the
subviews I am trying to add to the that view.  However, the
window remains plain, and I am at a loss as to what I missed
...

 I can't tell, because you didn't include all the
relevant code.

 How did you create mainPanelView? What is its frame? Who
is self (I
suspect it's an NSWindow subclass, but that's an
odd place to put code
to build its contents - it'd make more sense to put
that in a window
controller if anywhere).

--
I.S.


<ControlPanel.h><ControlPanel.m><ATT00001.txt>

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to