Saved printInfo causing isDocumentEdited to be YES
Saved printInfo causing isDocumentEdited to be YES
- Subject: Saved printInfo causing isDocumentEdited to be YES
- From: John Nairn <email@hidden>
- Date: Mon, 25 Nov 2002 15:29:49 -0700
I just added support in a document-based application to save the
printInfo data in the document. It works fine, but now whenever I open
a saved file, the document is opened and flagged as edited even when it
has not been edited it. It is annoying because it causes an alert every
time the document is closed.
Here are the details:
1. On opening a file, I recall the print object and use [self
setPrintInfo:obj] to record the printing info.
2. After completing that set (in my windowControllerDidLoadNib), I
cleared the change count using [self
updateChangeCount:NSChangeCleared]. At this time I tried NSLog() to
print isDocumentEditing and it correctly reports NO changes.
Nevertheless, when the window is done displaying, the change dot
appears (it looks there was a slight delay) and if I check
isDocumentEdited, it has changed to YES even though my code has never
called updateChangeCount.
3. I tried moving the [self updateChangeCount:NSChangeCleared] to a
second routine called from windowControllerDidLoadNib user
performSelector with 0 delay, but the same thing happens. The document
gets changed even though my code is not changing it.
4. I CAN FOOL IT! In windowControllerDidLoadNib, I can clear the change
count using
[self performSelector:@selector(finishLoad:) withObject:nil
afterDelay:10.0]
Now the document opens with no changes. The change dot appears (I am
assuming caused by internal Cocoa someplace) and then after my 10
second delay it gets cleared.
5. SUMMARY: why (or where) does setting a document's print info cause a
delayed document change status that is hard to stop? I am certain it is
the setting of printInfo that is causing the problem because if I
simply neglect to set it, the document is never marked as changed upon
reading. Is there a way to stop that change setting when loading a file?
------------
John Nairn (1-801-581-3413, FAX: 1-801-581-4816)
Web page:
http://www.mse.utah.edu/~nairn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.