• 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
Re: Trouble with preference pane
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble with preference pane


  • Subject: Re: Trouble with preference pane
  • From: Steve Bennett <email@hidden>
  • Date: Mon, 18 Mar 2002 16:01:35 -0500

Manuel Darveau wrote:

> I am creating a preference pane and want to feed my NSPopUpButton with info
> from the system.
>
> If I try the following, my PopUp are not updated with my data:
> - (void) mainViewDidLoad
> {
> [super mainViewDidLoad];
> [internalIface removeAllItems];
> [internalIface addItemsWithTitles:[self getInterfaceIPList]];
> }
>
> But if I add a button and link it with:
> - (IBAction)doDebug:(id)sender{
> [self mainViewDidLoad];
> }
>
> This work! My PopUp are updated... I tried also with the - (void)willSelect
> function but it doesn't either...

BTW -- calling mainViewDidLoad to do it is probably a bad idea - that's
called by the System Preferences app and shouldn't be called from within
your own code.

That said, it's hard to tell what's happening -- it depends on quite a few
things. If getInterfaceIPList is getting strings from a bundle string
resource, I've noticed in my own preference pane code that strings don't
always become available until much later in initialization, although why
willSelect doesn't fix it I don't know for certain.

Ideally, the place where you *should* be doing this is in the awakeFromNib:
method within your nib -- you know that at that time your popup outlet has
been initialized. If you can't do it from there, try doing it from within
your didSelect: method in the preference pane object.

Failing that, or better yet in addition to it, use your debugger, set a
breakpoint, and see what's actually happening. You can set your build
directory to <user>/Library/PreferencePanes, and your executable to System
Preferences, and source code debug your preference pane quite easily.

-->Steve Bennett
_______________________________________________
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: Stop a NSTask
  • Next by Date: Sub or superscripts with IB buttons
  • Previous by thread: Re: Trouble with preference pane
  • Next by thread: NSSocketPort, DO ignoring timeouts
  • Index(es):
    • Date
    • Thread