Undo with NSArrayController
Undo with NSArrayController
- Subject: Undo with NSArrayController
- From: Kevin Bracey <email@hidden>
- Date: Thu, 27 Jan 2011 14:55:15 +1300
Hi All,
I'm trying to patch in Undo and Redo to a NSTableView > NSArrayController > -( void )insertObject:( id )object inAllImportHeadersAtIndex:( NSInteger )index and -( void )removeObjectfromAllImportHeadersAtIndex:( NSInteger )index, using the example from Cocoa® Programming for Mac® OS X, Third Edition.
The Undo and Redo are working BUT (and we like big buts)
After Undoing an Insert the Object is deleted as expected from vanishes TableView as expected but there is a Ghost blank entry in the TableView as if the NSArrayController is aware of the change.
So, Add, Add, Add, Undo, Undo, Undo leaves me with 3 Ghost lines in the TableView. It seems that -( NSInteger )countOfAllImportHeaders is not being called.
Sending a reloadData to the TableView doesn't fix this. I must be missing something, again:-)
I'm wondering if it wouldn't be better to subclass NSArrayController and override something there, as it's normally doing the Adding and Removing?
Its strange that NSArrayControllers and Binding which are designed to reduce glue code??? require lots of glue code and makes implementing the Mac standard Undo/Redo a head scratcher.
cheers
Kevin _______________________________________________
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