error details in a NSAlert
error details in a NSAlert
- Subject: error details in a NSAlert
- From: Daniel Luis dos Santos <email@hidden>
- Date: Sun, 06 Apr 2014 02:19:15 +0100
Hello all,
I want to display some text indicating a list of errors the user should correct before submitting data.
I am using a modal NSAlert in which i set a message with a localised string from a table.
I want to include the error details and for that I was setting the informativeText field but it doesn’t show up unless its a string literal. I need it to be a variable value.
I also tried setting an accessory view but nothing is showed.
The code that uses the accessory view is below.
NSTextView *accessory = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,200,15)];
NSFont *font = [NSFont systemFontOfSize:[NSFont systemFontSize]];
NSDictionary *textAttributes = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
[accessory insertText: informativeText];
[accessory setEditable:NO];
[accessory setDrawsBackground:NO];
NSAlert* errorAlert = [NSAlert alertWithMessageText:NSLocalizedStringFromTable(@"The user data is not valid. Correct it and try again", @"AccountInfoTab", @"The user data is not valid. Correct it and try again") defaultButton:nil alternateButton:nil otherButton:nil informativeTextWithFormat: @""];
[errorAlert setAccessoryView: accessory];
[errorAlert runModal];
InformativeText is an NSMutableString.
What I am trying to do is even possible, or am I doing anything wrong ?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden