Re: How to bind to NSMutableArray that may contain zero objects?
Re: How to bind to NSMutableArray that may contain zero objects?
- Subject: Re: How to bind to NSMutableArray that may contain zero objects?
- From: Michael Crawford <email@hidden>
- Date: Tue, 10 Apr 2012 10:34:49 -0400
The problem I'm trying solve is that I have a crashing bug in the UI when an underlying array managed by an NSArrayController contains zero objects. The controls bound to the array-controller include an NSPopUpButton, an NSTextField, and four NSButtons.
-Michael
On Apr 3, 2012, at 6:53 PM, Quincey Morris wrote:
> On Apr 3, 2012, at 15:29 , Michael Crawford wrote:
>
>> Using and NSArrayController I'd like to bind the controller to an instance of NSMutableArray, which under certain circumstances may contain zero objects. I don't have any real experience with NULL placeholders but I assume this situation is what they are for. Can someone give me some guidance regarding how to leverage NULL placeholders in this situation or better yet, point me to an example?
>>
>> Alternatively, I'm thinking I can create my own dummy (placeholder) object and insert it into the array when there are no other real object instances to be accessed. If you have an opinion on this work-around, I'd like to hear from you, as well.
>
> There's nothing wrong with having an array of 0 elements, and no general need to create a placeholder to deal with this situation.
>
> Presumably, the real issue is what to show in your user interface when the array is empty, but you didn't give us much to go on for that.
>
> Note that array controllers automatically provide some placeholder objects for various situations, including no selection, multiple selection, and a nil object. Depending on what you're trying to do, these might provide a solution without additional coding.
>
> Can you back up one step and describe the problem you're actually trying to solve?
>
>
_______________________________________________
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