• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSPanel is freezing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPanel is freezing


  • Subject: Re: NSPanel is freezing
  • From: Matt Jaffa <email@hidden>
  • Date: Sun, 7 Nov 2004 15:12:58 -0700

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


Thanks, Matt

On Nov 7, 2004, at 2:14 PM, Olivier Lanctôt wrote:

I say post the code because it looks too blurry to me anyways.


On Sun, 7 Nov 2004 14:06:52 -0700, Matt Jaffa <email@hidden> wrote:
Hi,

I have an app that sits in the background as a daemon and only displays
a panel when it is necessary to get input from the user.
I am having it be a modal session each time it is displayed, those API
from NSApp, and then when they click on a button
it will close the panel. But after it keeps closing it and opening it
like after the fifth time the panel stays up and is frozen, can't click
on any of the buttons or radio, or drop down menus.


Anyone ever experienced this before, or should I post some code?

Thanks,
Matt

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden



--
Olivier


_______________________________________________ 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
  • Follow-Ups:
    • Re: NSPanel is freezing
      • From: j o a r <email@hidden>
References: 
 >NSPanel is freezing (From: Matt Jaffa <email@hidden>)
 >Re: NSPanel is freezing (From: Olivier Lanctôt <email@hidden>)

  • Prev by Date: Re: dynamically adding and binding NSTableColumns
  • Next by Date: Re: NSPanel is freezing
  • Previous by thread: Re: NSPanel is freezing
  • Next by thread: Re: NSPanel is freezing
  • Index(es):
    • Date
    • Thread