Window Doesn't Show Save Panel. How to Debug?
Window Doesn't Show Save Panel. How to Debug?
- Subject: Window Doesn't Show Save Panel. How to Debug?
- From: Jerry Krinock <email@hidden>
- Date: Fri, 29 Jun 2007 07:19:16 -0700
There are a dozen or so different editing actions that I can perform
on my app's document. Call these actions "A"-"Z".
When I close a document's "main" window (by hitting the red button
or cmd-W), I expect to see the Save panel if any editing action has
been performed. But if I have only performed certain editing
actions, say "D" and/or "E", I don't get the panel; it closes the
window and deallocs the document without saving. I suspect that I
have bastardized the Cocoa Document Architecture somehow and am
having great difficulty debugging this.
All my document window controllers are added to their document using
addWindowController: when they are created.
After performing ^any^ action "A"-"Z", I send, in my NSDocument subclass
[self updateChangeCount:NSChangeDone] ;
[[[self mainWindowController] window] setDocumentEdited:YES] ;
The "close" always dot turns dirty immediately, and I have verified
by NSLogging that isDocumentEdited is invoked (several times) as the
window is closing and always returns YES.
Are there any conditions under which a document window's -
performClose would ignore isDocumentEdited and bypass the "Save"
panel? I know that -[NSDocument close] will do this, but -close is
^not^ being invoked at any time. I close either by hitting the red
button or cmd-W.
Or, how could I debug such a thing? I would like to compare what the
framework is doing in the working vs. non-working test cases. So I
set a breakpoint in my window's subclass -performClose and hit cmd-
W. The first thing that happens is that my document's -
isDocumentEdited is invoked four times, and ^then^ it breaks in -
performClose.(*) But after the break, when I hit any of the "Step"
buttons, the document window either closes or shows the Save panel
immediately. I'd like to see what led up to that!
Thanks,
Jerry
(*) I am surprised and further confused by this sequence of events,
since cmd-W is wired directly to -performClose in IB's First
Responder, and only NSWindow implements -performClose.
_______________________________________________
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