Moving Table Columns and Undo Registration Weirdness
Moving Table Columns and Undo Registration Weirdness
- Subject: Moving Table Columns and Undo Registration Weirdness
- From: Andrew Madsen <email@hidden>
- Date: Fri, 22 Dec 2006 19:13:42 -0700
I'm seeing something a little strange in the app I'm developing.
It's a document based app, and each document has a table of (Core
Data) entities. Pretty standard stuff really. During initialization
of a document window, one of the things that I do in configuring the
UI is to set the table columns so they're in the same order as they
were when the document was last saved. This all works fine. The
problem I'm having is that if I open a document that was previously
saved (and therefore has a saved column order), the document
automatically is "dirty" showing as needing a save. I disable undo
registration during the entire "windowControllerDidLoadNib:" method.
I can cause the problem to disappear by (and only by) commenting out
the following line:
[myTable moveColumn: [myTable columnWithIdentifier: [columnsInOrder
objectAtIndex: i]] toColumn: i];
This line is inside of a for loop that iterates over all the columns
in the table. columnsInOrder is an array of column identifiers in
the order that they should appear, so all this line is doing is
moving each column to the same index in the table as it appears in
the "order array". Anyway, undo registration for the MOC's undo
manager is disabled while this is being run, yet the document appears
dirty.
Any insights into this problem? I can look at the entire set of
registeredObjects in the MOC before and after the one undo in the
undo stack after a document is opened, and there is no difference.
Is there a way to monitor the things that are being registered with
the undo manager? One thing that might be important is that when a
document is first opened, even after the columns are in the right
order, the document doesn't appear "dirty". It sometimes takes a
couple seconds (especially on a slower machine) before it becomes
dirty. It's as if something behind the scenes is causing an undo
registration, but I can't figure out what it would be or how it's
related to moving table columns.
Thanks,
Andrew
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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