Re: NSPanel is freezing
Re: NSPanel is freezing
- Subject: Re: NSPanel is freezing
- From: j o a r <email@hidden>
- Date: Sun, 7 Nov 2004 23:43:13 +0100
To me it looks a bit overly complicated, and also a bit weird. You only
process events once per second? Anyway, a couple of questions:
Do you have a standard NSRunLoop running?
Why not use a standard "runModalForWindow:"?
Why run modal at all, if it's the only GUI available to the user?
j o a r
On 2004-11-07, at 23.12, Matt Jaffa wrote:
Ok here is the code:
This is where it displays it:
[displayAlertPanel setLevel:NSPopUpMenuWindowLevel];
//[displayAlertPanel setLevel:NSScreenSaverWindowLevel];
[displayAlertPanel setDelegate:self];
[displayAlertPanel makeKeyAndOrderFront:self];
[seconds setStringValue:@"40"];
printf("comes here----1\n");
//[NSApp activateIgnoringOtherApps:YES];
session = [NSApp beginModalSessionForWindow:displayAlertPanel];
printf("comes here----2\n");
int dontdorest = 1;
NSDate *startDate = [NSDate date];
NSDate *currentDate;
buttonpressed = 0;
[dataSending setString:@""];
NSString * thestring = @"";
unsigned char * buff = point->buffer;
int length = point->buf_len;
for (;;) {
usleep(1000000);
currentDate = [NSDate date];
NSTimeInterval interval = [currentDate
timeIntervalSinceDate:startDate];
printf("Interval: %f\n", interval);
int final = 40 - (int)interval;
[seconds setStringValue:[NSString stringWithFormat:@"%d", final]];
if(final < 15) {
[seconds setTextColor:[NSColor redColor]];
}
if ([NSApp runModalSession:session] != NSRunContinuesResponse) {
dontdorest = 0;
break;
}
if(interval > 40) {
[NSApp stopModal];
buttonpressed = 1;
[displayAlertPanel close];
break;
}
}
[NSApp endModalSession:session];
//[NSApp runModalForWindow:displayAlertPanel];
//[displayAlertPanel close];
if(dontdorest) {
printf("was ended by timeout\n");
} else {
printf("was ended by buttonp\n");
}
And here is where the action buttons are:
- (IBAction)allowAction:(id)sender
{
printf("allow Action pressed\n");
buttonpressed = 1;
[NSApp stopModal];
[displayAlertPanel close];
}
- (IBAction)denyAction:(id)sender
{
printf("deny Action pressed \n");
buttonpressed = 1;
[NSApp stopModal];
[displayAlertPanel close];
}
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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