Hi there,
After closing Dialog box(NSView), control is not coming back to dialog box creator function.
I am creating dialog box using NSView and subclass of NSWindowController classes and .xib file.
App Controller class has following code to display the dialog box:-
Dialog box has one input field for password. Dialog box is getting shown and user can input some text in dialog box and clicks OK button. OK button click handler function is also being called then inside OK button's handler function, I am closing the dialog box. But control is not coming back to App controller function (has debug point also) line after showWindow call (Line:- NSString *inputPassword = [encPassController password]
.
NSWindowController class code:-
EncryptPasswordDlgController.h
EncryptPasswordDlgController.m
Thanks so much in advance.
Pankaj
After closing Dialog box(NSView), control is not coming back to dialog box creator function.
I am creating dialog box using NSView and subclass of NSWindowController classes and .xib file.
App Controller class has following code to display the dialog box:-
Code:
[B]encPassController = [[EncryptPasswordDlgController alloc] init];
[encPassController showWindow:self];
[U][I]NSString *inputPassword = [encPassController password];[/B][/I][/U]
Dialog box has one input field for password. Dialog box is getting shown and user can input some text in dialog box and clicks OK button. OK button click handler function is also being called then inside OK button's handler function, I am closing the dialog box. But control is not coming back to App controller function (has debug point also) line after showWindow call (Line:- NSString *inputPassword = [encPassController password]
NSWindowController class code:-
EncryptPasswordDlgController.h
Code:
#import <Cocoa/Cocoa.h>
@interface EncryptPasswordDlgController : NSWindowController
{
NSWindowController *encryptPasswordDlgWindowController;
IBOutlet NSSecureTextField *passwordField;
NSString *password;
}
-(IBAction)clickOK:(id) sender;
-(NSString *)password;
@end
EncryptPasswordDlgController.m
Code:
#import "EncryptPasswordDlgController.h"
@implementation EncryptPasswordDlgController
-(id) init
{
return self;
}
- (IBAction)showWindow:(id)sender
{
encryptPasswordDlgWindowController = [[NSWindowController alloc] initWithWindowNibName:@"EncryptionPasswordDlg"];
[encryptPasswordDlgWindowController loadWindow];
[[self window] makeKeyAndOrderFront:[self window]];
return;
}
-(IBAction)clickOK:(id) sender
{
password = [passwordField stringValue];
NSLog(@"password is %@", password);
[[self window] close];
return;
}
-(NSString *)password
{
return password;
}
@end
Thanks so much in advance.
Pankaj