Skip navigation.
 
mlRe: saveDocument newbie question
FROM : Alan Smith
DATE : Tue Jun 20 22:15:15 2006

Neto,

Have you printed out the arrays? You said: "But if I just edit an
existing item, both arrays remains the same..." Do you mean your code
never executes or that the items really don't ever change? If it's the
first one I suggest you use a NSEnumerator to iterate through one
array and compare it against the other. If you then get to an object
that isn't the same you can updateChangeCount. Like this:

- (void)checkArray:(id)sender
{
    NSEnumerator *enumerator = [editedArray objectEnumerator];
    id object;

    while (object = [enumerator nextObject];)
    {
          if (! [uneditedArray containsObject: object])
          {
              //code to updateChangeCount
              [self updateChangeCount: NSChangeDone];
              break;
          }
          else
          {
              [self updateChangeCount: NSChangeCleared];
              break;
          }
    }
    [uneditedArray release];
    uneditedArray = [[NSMutableArray alloc] initWithArray: editedArray];
}

There. That will go through the array that is displayed in the table
checking it with the duplicate. If there is an object in the
editedArray that isn't in the uneditedArray then it will
updateChangeCount to set as needing saving. If they' re the same then
it sets the document as not needing saving. That should do it.

Peace, and good luck, Alan


--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"Don't waste your life doing things others have already done."

Related mailsAuthorDate
mlExcluding native file type from saveDocumentTo: accessory view. Joshua Scott Emmon… Jun 18, 05:12
mlsaveDocument newbie question Neto Jun 18, 23:29
mlRe: saveDocument newbie question Andrew Merenbach Jun 19, 00:19
mlRe: saveDocument newbie question Alan Smith Jun 19, 16:45
mlRe: saveDocument newbie question Neto Jun 19, 17:10
mlRe: saveDocument newbie question Alan Smith Jun 19, 19:03
mlExcluding native file type from export sheet. Joshua Scott Emmon… Jun 20, 02:59
mlRe: saveDocument newbie question Kevin Hoctor Jun 20, 04:15
mlRe: saveDocument newbie question Neto Jun 20, 06:39
mlRe: saveDocument newbie question Alan Smith Jun 20, 22:15
mlRe: saveDocument newbie question Neto Jun 21, 03:15
mlRe: saveDocument newbie question mmalcolm crawford Jun 21, 03:40