Re: NSRunAlertPanel with checkbox?
Re: NSRunAlertPanel with checkbox?
- Subject: Re: NSRunAlertPanel with checkbox?
- From: Aaron Tuller <email@hidden>
- Date: Wed, 11 May 2005 16:27:58 -0700
this is how I do it...may not be the safest way...but it's worked fine:
NSPanel *panel = NSGetAlertPanel(title,body, @"OK", nil,
@"Don't Remind Me Again");
NSButton *remind = nil;
NSButton *ok = nil;
id obj;
NSEnumerator *e = [[[panel contentView] subviews] objectEnumerator];
while (obj = [e nextObject])
{
if ([obj isKindOfClass:[NSButton class]])
{
if ([[obj title] isEqualToString:@"Don't Remind Me Again"])
{
remind = obj;
}
else if ([[obj title] isEqualToString:@"OK"])
{
ok = obj;
}
}
}
[remind setButtonType:NSSwitchButton];
[remind setAllowsMixedState:NO];
[remind setState:NSOffState];
[remind setAction:NULL];
[remind sizeToFit];
[remind displayIfNeeded]; // probably not needed
[remind setFrame:NSOffsetRect([remind frame], 0, 3)];
[remind setNeedsDisplay:YES];
int i = [NSApp runModalForWindow:panel];
[panel orderOut:self];
BOOL dontRemindMe = ([remind state] == NSOnState);
if (dontRemindMe)
{
[defaults setBool:YES forKey:key];
}
NSReleaseAlertPanel(panel);
-aaron
At 4:08 PM -0700 5/11/05, Justin Hawkwood wrote:
Is there a simple way, like using NSRunAlertPanel, to get an alert
panel with a checkbox (ie "Don't show this again" checkbox)?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden