• 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: Self closing PopUp Window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Self closing PopUp Window (From: Dan Yocom <email@hidden>)

  • Prev by Date: Re: ADC Core Data article
  • Next by Date: Re: ADC Core Data article
  • Previous by thread: Self closing PopUp Window
  • Next by thread: deactivating an NSScrollView
  • Index(es):
    • Date
    • Thread