• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
PrefPane interface values not set during mainViewDidLoad or didSelect
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PrefPane interface values not set during mainViewDidLoad or didSelect


  • Subject: PrefPane interface values not set during mainViewDidLoad or didSelect
  • From: KLW <email@hidden>
  • Date: Tue, 23 Dec 2003 16:17:20 -0500

Hello all,

I'm building a preference pane, and of course want to set up the preference pane during load to accurately display it's current settings.

According to Apple's documentation, a preference pane should first call idInitWithBundle and then set it's values with mainViewDidLoad. However, the outlets I set during mainViewDidLoad are not updated, ever. I put an NSLog statement in mainViewDidLoad, and the call is definitely being made.

I've searched the archives and the only answer that seemed relevant was that I needed to make sure I'd connected my outlets to the correct subclass of NSPreferencePane (which I believe I've done right).

Here's the relevant part of my code:

- (id)initWithBundle:(NSBundle *)bundle
{
if ( ( self = [super initWithBundle:bundle] ) != nil ) {
appId = CFSTR("com.theApotek.XJanitor");
}
NSLog(@"initWithBundleSpeaking");
return self;
}

- (void)mainViewDidLoad
{
[messageOutput setStringValue: @"messageOutput will not get updated with this string."];
lockFileName = @"/private/tmp/XJanitor.lock";//instance variable lockFileName declared in .h does not seem to be available later in the prefPane.
...
}

Two things are failing: 1) The text field messageOutput does not get the string passed to it, but is blank when the preference pane loads. 2) the variable lockFileName is "lost"; even though it's an instance variable declared. It is not available to any of the other methods in the PrefPane; accessing it in other methods reveals it to be blank.

The interesting thing is that when I make IDENTICAL declarations in awakeFromNib, everything works fine. But Apple's documentation tells us to use mainViewDidLoad. Also, awakeFromNib does not update the prefPane ones on subsequent selections of it, unless you first quit SystemPreferences. Ideally I want to set more "permanent" values in mainViewDidLoad (because that what Apple's docs say to do), and then the more dynamic ones, I would like to be able to set in didSelect... but that doesn't work either.

Any insights? Thanks.

Kristofer
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Path of imagefile that was dragged to NSImageView
  • Next by Date: Re: Stripping formatting ...
  • Previous by thread: Re: Path of imagefile that was dragged to NSImageView
  • Next by thread: Re: Stripping formatting ...
  • Index(es):
    • Date
    • Thread