Re: NSPopupButton in main window changes when NSUserDefaultsController adds/removes item in Preference Pane
Re: NSPopupButton in main window changes when NSUserDefaultsController adds/removes item in Preference Pane
- Subject: Re: NSPopupButton in main window changes when NSUserDefaultsController adds/removes item in Preference Pane
- From: Tony Kambourakis <email@hidden>
- Date: Wed, 4 Jul 2007 07:13:01 +1000
Hi Matt,
I set the NSPopupButton selectItem to nil in awakeFromNib in my view
controller.
So when the main screen appears, the NSPopupButton is prefilled with
the content from NSUserDefaults but shows an empty selection.
NSPopupButton is enabled when the user adds an item to another
NSTableView in the main window.
However, if the user opens the Preferences window and changes the
content of the NSUserDefaults via a Preference NSTableView (just a
list of items), for some reason the selection of the NSPopupButton is
automatically set to the first in the list. This happens whether I
add or remove an item from the Preference window.
If I bind the selectedIndex to something, won't I lose the ability
for the user to change the selection? And what would I bind it to?
(PS I am new to the Mac platform and Objective-C/Cocoa. Thanks for
your help and your patience!)
Tony.
On 04/07/2007, at 3:42 AM, Matt Neuburg wrote:
On Tue, 3 Jul 2007 11:33:05 +1000, Tony Kambourakis
<email@hidden> said:
I have an NSPopupButton in my main application window that is bound
to an NSArrayController which in turn is bound to the Defaults
Controller (NSUserDefaultsController) point to that list of items.
I initially set the NSPopupButton to "unselect" items so that even
though it has content via the bindings to the default list of items,
it shows a blank item as nothing is selected.
As soon as I add/remove an item in the Preference window table, for
some reason the NSPopupButton selects the first item on its list. I
would rather the user make the selection. I don't know why the
NSPopupButton updates itself like that. Why would the selection
of an
item in NSPopupButton be linked to the process of adding/removing an
item to the NSUserDefaultsController?
You evidently imply above that the popup button's *content* is
bound. But
what about the popup button's *selection*? It needs to get
selectedIndex
info from somewhere. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden