FROM : j o a r
DATE : Mon Jun 16 17:59:17 2008
On Jun 16, 2008, at 8:07 AM, David Harper wrote:
> I am setting up a preferences window, and I would like awakeFromNib:
> to be invoked earlier than it does. Currently, it only gets invoked
> when the preferences window is shown / opened.
You can call: -[NSWindowController loadWindow]
But I'm not sure if that's really what you should be doing - see my
comments below.
> I expected that there might be an option to specify this in the .nib
> file itself, and I got my hopes up with the "deferred" check box
> which is enabled by default - the tooltip said "Sets whether the
> window server creates a window device for the window immediately.
> When YES, the window server defers creating the window device until
> the window is moved onscreen."
No, this checkbox controls something else at a lower level, something
you shouldn't mess with.
I have to say, I'm not even sure why we have a checkbox for this in
IB...
> Right now the reason I want to do this is that the contents of the
> controls in the preferences windows can themselves be used to save
> the preferences. For example I'd stick [backgroundColor color] in a
> dictionary (where backgroundColor is a color well) instead of
> managing my own NSColor * and responding to delegate methods.
If I read this correctly, you use the controls in your window as model
objects to store preferences that are accessed by other parts of your
application? If so, I'd suggest that this is a design flaw that you
should fix. The view objects in your application should not double as
model objects - See: The MVC design pattern.
j o a r
DATE : Mon Jun 16 17:59:17 2008
On Jun 16, 2008, at 8:07 AM, David Harper wrote:
> I am setting up a preferences window, and I would like awakeFromNib:
> to be invoked earlier than it does. Currently, it only gets invoked
> when the preferences window is shown / opened.
You can call: -[NSWindowController loadWindow]
But I'm not sure if that's really what you should be doing - see my
comments below.
> I expected that there might be an option to specify this in the .nib
> file itself, and I got my hopes up with the "deferred" check box
> which is enabled by default - the tooltip said "Sets whether the
> window server creates a window device for the window immediately.
> When YES, the window server defers creating the window device until
> the window is moved onscreen."
No, this checkbox controls something else at a lower level, something
you shouldn't mess with.
I have to say, I'm not even sure why we have a checkbox for this in
IB...
> Right now the reason I want to do this is that the contents of the
> controls in the preferences windows can themselves be used to save
> the preferences. For example I'd stick [backgroundColor color] in a
> dictionary (where backgroundColor is a color well) instead of
> managing my own NSColor * and responding to delegate methods.
If I read this correctly, you use the controls in your window as model
objects to store preferences that are accessed by other parts of your
application? If so, I'd suggest that this is a design flaw that you
should fix. The view objects in your application should not double as
model objects - See: The MVC design pattern.
j o a r
| Related mails | Author | Date |
|---|---|---|
| David Harper | Jun 16, 17:07 | |
| David Harper | Jun 16, 17:27 | |
| Jens Alfke | Jun 16, 17:46 | |
| j o a r | Jun 16, 17:59 | |
| Jens Alfke | Jun 16, 18:04 |






Cocoa mail archive

