Re: Self closing PopUp Window
Re: Self closing PopUp Window
- Subject: Re: Self closing PopUp Window
- From: Ryan Stevens <email@hidden>
- Date: Fri, 8 Apr 2005 08:23:48 -0700
On Apr 8, 2005, at 7:44 AM, Dan Yocom wrote:
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:
[snip]
window = [[CustomWindow alloc] initWithContentRect:contentRect
styleMask: NSMiniaturizableWindowMask | NSClosableWindowMask |
NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
The 'window' ivar is getting changed every time this method is called.
Do something like this instead:
{
NSWindow *window = [[CustomWindow alloc] initWithContentRect:contentRect
styleMask: NSMiniaturizableWindowMask | NSClosableWindowMask |
NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
[window setReleasedWhenClosed:YES];
[NSTimer scheduledTimerWithTimeInterval:5 target:self
selector:@selector(closeWindow:) userInfo:window repeats:NO];
}
- (void)closeWindow:(id)timer
{
[[timer userInfo] orderOut:self];
}
_______________________________________________
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