Execute Function when loading a Preference Pane
4 answers - 652 bytes -

I'm trying to get code to execute when a preference pane is loaded.
I tried overriding the init function, but evidently the NIB hooks
don't exist at that point. Is there something I can trap for when
the interface is finished being built but before the user sees
anything? I want to update the state of the preference pane so that
it accurately displays the state.
Sorry, I know I'm a bit of a newbie at this, and this is probably
something really easy, but I haven't found a whole lot of examples
that deal with the PreferencePane environment as opposed to a stand-
alone app.
Thanks!
- Ben
No.1 | | 70 bytes |
| 
How about -awakeFromNib? This isn't specific to preference panes.
No.2 | | 275 bytes |
| 
Thank you!
That was exactly what I was looking for! You're a genius!
How would I have found out about this if it wasn't for you?
I couldn't even find it in my reference API and only found the
definition through a google search.
- Ben
No.3 | | 701 bytes |
| 
Not to want to detract anything from I. Savant's genius :-), but have
a look at Chapter 3 of the Cocoa fundamentals guide. In Basic
Subclass Design, it explains awakeFromNib along with other methods
relevant to object creation. I find the fundamentals guide a very
good reference when I don't know exactly what I'm looking for.
Hank
Feb 2, 2007, at 12:20 PM, Ben Ku wrote:
Thank you!
That was exactly what I was looking for! You're a genius!
How would I have found out about this if it wasn't for you?
I couldn't even find it in my reference API and only found the
definition through a google search.
- Ben
No.4 | | 374 bytes |
| 
Not to want to detract anything from I. Savant's genius :-)
Yes, don't you dare! :-)
A good suggestion, though there are times when even the most
advanced developers (of which I am most certainly not one) have to
"go back to basics". The fundamentals guide is a good place to look
for some of these seemingly vague-and-mysterious concepts.