Re: NSComboBox and sorted list
Re: NSComboBox and sorted list
- Subject: Re: NSComboBox and sorted list
- From: Frédéric Testuz <email@hidden>
- Date: Sat, 26 Apr 2014 17:14:40 +0200
Le 18 avr. 2014 à 13:32, Frédéric Testuz <email@hidden> a écrit :
>
> I have a typical CoreData application which display my entities in an NSTableView with an NSArrayController and a panel to edit the selected item.
>
> I have an entity Book with a NSString attribute type displayed in an NSComboBox. I want the drop down list of the combo box to display the previously chosen types. I have an NSArrayController bind with the Book entity and the managed object context.
>
> I can make it works by binding the NSComboBox :
> Content (or Content Values) -> email@hidden
> Value -> BookArrayController.selection.type
>
> Until this point all is well, but I want the list to be sorted. So I think I have to add a NSArrayController which will maintain the sorted list of types. I try this :
>
> TypeListArrayController :
> Content Array -> email@hidden
>
> NSComboBox :
> Content -> TypeListArrayController.arrangedObjects
> Value -> BookArrayController.selection.type
>
> But with this setting, when I open my document (when the window is displayed) it takes a looooooooong time. More than 10min when at first it takes 1s. I check by stopping in the debugger, the stack frame is more than 38000 with huge recursivity.
>
> Is there a solution with NSArrayController and binding or I have to implement a data source for the combo box manually ?
After trying some things I have it working by manually implementing the data source and observing my BookArrayController for change of the type property.
For information, in my second test, if dont bind the combo box to the array controller, there is no delay. So the recursive problem appears with the interaction of the bindings between NSComboBox<->TypeListArrayController and TypeListArrayController<->BookArrayController
_______________________________________________
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