Self closing PopUp Window
Self closing PopUp Window
- Subject: Self closing PopUp Window
- From: Dan Yocom <email@hidden>
- Date: Fri, 8 Apr 2005 10:44:10 -0400
Hi,
I am trying to write a function that displays a message in a window
and then disappears after a few seconds. however, I can oly get it to
work for one window at a time (IE I cant have two windows displayed at
the same time.) Below is my code:
-----------NSWINDOW SUBCLASS (called CustomWindow)------------------
NSWindow* result;
- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned
int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag
{
result = [super initWithContentRect:contentRect
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered
defer:NO];
[result setLevel: NSStatusWindowLevel];
[self performSelector:@selector(closeSplashScreenPanel)
withObject:nil afterDelay:3];
return result;
}
- (void)closeSplashScreenPanel
{
[result close];
}
-------------function in APP ------------------------
CustomWindow *window;
- (void) PopUp: (NSString*) message
{
NSRect contentRect = NSMakeRect(200, 180, 300, 150);
window = [[CustomWindow alloc] initWithContentRect:contentRect
styleMask: NSMiniaturizableWindowMask | NSClosableWindowMask |
NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
[NSApp activateIgnoringOtherApps:YES];
[window setTitle:@"Sample Popup"];
[window makeKeyAndOrderFront:self];
}
Like I said above, this works If I only call the function once and
wait for it to close and then call it again. Any idea on how to fix
this?
Thanks,
Dan
_______________________________________________
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