Reputation: 13
I have used the following code to add a NSTextField onto the NSAlert successfully:
NSAlert *alert = [NSAlert alertWithMessageText: @"Password"
defaultButton:@"OK"
alternateButton:@"Cancel"
otherButton:nil
informativeTextWithFormat:@""];
NSTextField *input = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 200, 24)];
[input setStringValue:@""];
[input autorelease];
[alert setAccessoryView:input];
NSInteger button = [alert runModal];
However the displayed NSTextField on NSAlert doesn't allow to type text, whatever I enter it does not show on the NSTextField. I also tried the set Enabled and Editable to YES but nothing changed.
Upvotes: 1
Views: 816