Hi all,

Thanks for the response to this question. After a bit of digging in Interface Builder I realised that the basic bindings for Next and Previous buttons are there, as well as the actions in the NSArrayController. I'm not sure whether this is what the reply below was trying to tell me! Anyway, it turns out to be really easy to do the next and previous buttons. In case it is of use to anyone else, here is what to do. If this is all blindingly obvious, forgive the intrusion!

Suppose you have an NSArrayController in a window that you have created as a result of dragging in a Core Data Entity. Add two buttons from the Library to provide the Next and Previous UI controls. Then, taking the Next button as an example, you can set the binding as follows: In the Availability>Enabled section in the Inspector Bindings tab, bind to the appropriate NSArrayController. and choose canSelectNext as the Controller Key. Then control-drag from the button to the controller in the main window and choose the selectNext: action. The process for Previous is similar.

Anyway, I hope someone else finds this useful.

Regards,


Ian.
--
ianpi...@mac.com
07590 685840 | 01926 811383






On 12 Jul 2009, at 2:48pm, I. Savant wrote:

On Jul 12, 2009, at 8:51 AM, Ian Piper wrote:

Can anyone tell me whether there are any plug-ins or examples that show how to implement buttons to move forward and backward through a record set in a Core Data application? I am thinking of having a window that simply presents one record from a collection, with forward, backward, first and last buttons.

This isn't really a "Core Data" question, but rather a bindings question.

Read up on Cocoa Bindings and NSArrayController. All you need to do is modify the selection as desired when these buttons are pressed via -[NSArrayController setSelectionIndex:] or -[NSArrayController setSelectionIndexes:], keeping in mind the array controller's - arrangedObjects (and the count thereof).

If the rest of your detail view is bound to this array controller's selectedObjects.whateverKeys, you're done.

--
I.S.





_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to