This is the approach I ended up taking:
// in MyDocument.m
- (void) saveDocument:(id)sender {
[[self windowControllers]
makeObjectsPerformSelector:@selector(myPrepareToSave:)];
[super saveDocument:sender];
}
// in MyWindow.m
- (void) myPrepareToSave:(id)sender {
[[self
On Fri, May 30, 2008 at 3:33 PM, David Carlisle
[EMAIL PROTECTED] wrote:
The myPrepareToSave method in MyWindow allowed me to experiment with the
commitEditing method. I tried sending it to either my NSWindowController or
to the NSArrayController which is bound to the NSCollectionView which
On 5/28/08 9:15 PM, David Carlisle said:
If I'm adding text to an NSTextField, then I select Save, somehow the
message needs to get to the NSTextField wherever it is that it needs
to terminate editing and send its contents to the model before the
model is saved. I don't see how I should go about
I'm not using Core Data. Perhaps that is part of why commitEditing
doesn't work.
I also mistakenly thought that NSWindowController was an NSController,
and would respond to a commitEditing.
DC
On May 30, 2008, at 2:17 PM, Sean McBride wrote:
Are you using Core Data? Have you seen:
I'm binding my NSCollectionView to my NSArrayController, so I expected
sending a commitEditing to the NSArrayController would work.
On May 30, 2008, at 2:09 PM, Kyle Sluder wrote:
On Fri, May 30, 2008 at 3:33 PM, David Carlisle
[EMAIL PROTECTED] wrote:
The myPrepareToSave method in MyWindow
On 30 May 2008, at 20:33, David Carlisle wrote:
This is the approach I ended up taking:
// in MyDocument.m
- (void) saveDocument:(id)sender {
[[self windowControllers]
makeObjectsPerformSelector:@selector(myPrepareToSave:)];
[super saveDocument:sender];
}
// in MyWindow.m
-
After your suggestion, I recalled and reviewed figure 6 about Saving
a Document in the Document Based Applications Overview. That made it
clear to me that saveDocument does call the saveDocumentWithDelegate
method.
Then I tried your scenario of closing an unsaved doc. Under the old
Make the window the first responder in your document's saveDocument
method...
- (IBAction)saveDocument:(id)sender
{
NSWindow* window = [self windowForSheet];
[window makeFirstResponder:window];
[super saveDocument:sender];
}
On May 28, 2008, at 11:15 PM, David Carlisle
On Wed, May 28, 2008 at 11:15 PM, David Carlisle
[EMAIL PROTECTED] wrote:
If I'm adding text to an NSTextField, then I select Save, somehow the
message needs to get to the NSTextField wherever it is that it needs to
terminate editing and send its contents to the model before the model is
I would advise against that exact approach as there are lower level
save methods which can be called without -saveDocument: being used.
Have a look through the NSDocument for details on the over -save…
methods.
On 29 May 2008, at 13:41, Dave Fernandes wrote:
Make the window the first
On 29 May '08, at 6:17 AM, Roland King wrote:
why does that work?
It causes the textfield to lose focus, which ends editing, so it tells
its target bindings that its value changed.
—Jens
smime.p7s
Description: S/MIME cryptographic signature
11 matches
Mail list logo