It seems that I can't control the NSApp delegate from within a System Preferences pane, which is understandable. Is there any other way I can have my object notified when the program becomes active?
NSPreferencePane gives you a few methods you can override to respond to changes. In particular, mainViewDidLoad:
gives you a chance to do initialization when your preference pane becomes active for the first time.
If you actually meant you want to keep track of when the System Preferences window becomes main or key, you can subscribe to NSWindow's notifications for those events.
Most delegate methods in the Cocoa frameworks are simply notification methods. This includes application{Will,Did}{Become,Resign}Active:
, which are notification methods for NSApplication{Will,Did}{Become,Resign}ActiveNotification
. The notifications are in the same place as the delegate methods: the NSApplication documentation.
So, just sign up for those notifications on the local NSNotificationCenter
.