NSBeginAlertSheet() in selectionShouldChangeInTableView:
NSBeginAlertSheet() in selectionShouldChangeInTableView:
- Subject: NSBeginAlertSheet() in selectionShouldChangeInTableView:
- From: Bertrand Mansion <email@hidden>
- Date: Fri, 24 Oct 2003 17:13:37 +0200
Hi,
I am trying to figure out how to let my user be warned that her changes will
be lost if she changes the selection in a tableview.
So far, I am using the selectionShouldChangeInTableView: delegate method. If
the main content is not modified, it returns YES. If it has been modified,
it will show an alert panel asking the user to confirm whether she wants to
"Save", "Cancel" or "Don't Save" the changes she made.
"Cancel" will cancel the selection change.
"Save" will save the changes and swap the selection in the tableview.
"Don't Save" will just swap the selection in the tableview.
Here is some of my code in selectionShouldChangeInTableView:
if ([structure isModified]) {
NSBeginAlertSheet(
alertMessage,
@"Save", @"Don't Save", @"Cancel",
myWindow, self,
@selector(saveSheetDidEnd:returnCode:contextInfo:),
nil,
NULL,
@"Your changes will be lost if you don't save them.");
// What value to return here ?
} else {
return YES;
}
Then I have implemented the saveSheetDidEnd:returnCode:contextInfo: method.
It saves some data and this process might take a little while.
I don't know how to have selectionShouldChangeInTableView: return the right
BOOL value based on the user input. Should it return NO and let
saveSheetDidEnd: decide where the selection should go ? Or is there any more
direct option ?
Thanks for your help,
Bertrand Mansion
Mamasam
http://cocoa.mamasam.com
_______________________________________________
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.