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

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

  • Follow-Ups:
    • Re: Self closing PopUp Window
      • From: Ryan Stevens <email@hidden>
  • Prev by Date: Re: Unable to delete controls in Interface Builder
  • Next by Date: Re: ADC Core Data article
  • Previous by thread: Re: placeholder text in NSTextView
  • Next by thread: Re: Self closing PopUp Window
  • Index(es):
    • Date
    • Thread