Running a sheet (threads)
Running a sheet (threads)
- Subject: Running a sheet (threads)
- From: Francisco Tolmasky <email@hidden>
- Date: Wed, 16 Apr 2003 00:11:17 -0700
I'm attempting to implement an application wide error UI for myself in
the main controller class. I would like to have a class method that
runs a unique panel I made as a sheet and returns the corresponding
code, I attempted this as so:
@implementation GSController
+ (id)sharedInstance
{
return [NSApp delegate];
}
// ...
+ (BOOL)userWarningWithTitle:(NSString *)aTitle
message:(NSString *)aMessage
userDefaultKey:(NSString *)aKey
cancelButton:(NSString *)cancelButtonString
okButton:(NSString *)okButtonString
{
_GSControllerWorkingUserDefaultKey= aKey;
[[GSController sharedInstance]
_setUserWarningTitle: aTitle
message: aMessage
cancelButton: cancelButtonString
okButton: okButtonString];
[NSApp beginSheet: [[GSController sharedInstance] _userWarningPanel]
modalForWindow: [NSApp keyWindow]
modalDelegate: [GSController sharedInstance]
didEndSelector:
@selector(userWarningSheetDidEnd:returnCode:contextInfo:)
contextInfo: nil];
return _GSControllerWorkingReturnCode;
}
- (void)userWarningSheetDidEnd:(NSWindow *)sheet
returnCode:(int)returnCode
contextInfo:(void *)contextInfo
{
_GSControllerWorkingReturnCode= returnCode;
}
- (IBAction)endUserWarning:(id)sender
{
[_userWarningPanel orderOut: sender];
[NSApp endSheet: _userWarningPanel returnCode: [sender tag]];
}
@end
The problem is, the sheet is threaded or something, because it does not
way for the sheet to go away before it gets to the return. Can someone
help me figure out what to do instead? I know that running
NSbeginAlertSheet() achieves this somehow so it must be doable.
Thanks in advance :)
Francisco Tolmasky
email@hidden
http://users.adelphia.net/~ftolmasky
_______________________________________________
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.