On Apr 5, 2014, at 18:19 , Daniel Luis dos Santos <daniel.d...@gmail.com> wrote:

> 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 don’t know what you mean here. The question of whether it’s a string literal 
is irrelevant, since the string is passed as a parameter to a NSAlert method, 
regardless of origin. Can you show code?

> 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];

Don’t use this method. The documentation describes it as a “compatibility” 
method, and so I wouldn’t assume that it behaves exactly as the recommended 
technique — which is to create a NSAlert object first, then to set the various 
properties.

Or, since you’ve tried 2 ways to display the contents of your ‘informativeText’ 
variable and failed, this might be evidence that it doesn’t contain the string 
you think it should contain.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to