Hi Guys I am trying to display a custom modal dialogue box and am doing it the following way:
EncPasswordSheet is of IBOutlet NSWindow * type.
@implementation EncryptionPasswordSheet
-(id)init
{
return self;
}
(void)showCustomDlg:(NSWindow *)window {
if (!EncPasswordSheet)
{
[NSBundle loadNibNamed: @"EncryptionPasswordDlg" owner: self];
}
[NSApp beginSheet:EncPasswordSheet modalForWindow:window modalDelegate:nil didEndSelector:nil contextInfo:nil];
[NSApp runModalForWindow: EncPasswordSheet];
[NSApp endSheet: EncPasswordSheet];
[EncPasswordSheet orderOut: self];
}
(IBAction)getPasswordFromSheet:(id)sender {
password = [passwordField stringValue];
[NSApp stopModal];
}
- (IBAction)cancelEncPasswordSheet:(id)sender
{
password = nil;
[NSApp stopModal];
}
@end
The problem is that the dialogue box is getting displayed well and its taking input and on pressing ok or cancel, their respt IBAction methods are getting executed and program is continuing to execute except with one problem: the dialogue box is not getting out of the way i.e its not getting clsed or dissappearing. Please tell where i am going wrong.
Thanks