FROM : Dan Yocom
DATE : Thu Apr 14 23:41:30 2005
Hi,
I created a subclass of NSWindow that automatically closes the
window after three seconds. The subclass works as it should when
called from a normal objective-C routine/function. However, if I call
it from within a NSThread I create, it will popup but not close. Does
anyone know why it won't work porpperly when call from within an
NSThread?
---------------------------------- Custom NSWindow class
--------------------------------
- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned
int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag
{
NSWindow* result = [super initWithContentRect:contentRect
styleMask:aStyle backing:NSBackingStoreBuffered defer:NO];
[result setLevel: NSStatusWindowLevel];
[self performSelector:@selector(closeSplashScreenPanel)
withObject:nil afterDelay:3];
return result;
}
- (void)closeSplashScreenPanel
{
[self release];
}
---------------------------------- NSThread Stuff
---------------------------------------------
[NSThread detachNewThreadSelector: @selector(MyThread) toTarget:self
withObject:nil];
- (void)MyThread
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
//Programatically Create and display window here
//in my actuall program I have a hole bunch of
stuff running in a while loop
[pool release];
}
Any help would be great,
Dan Yocom
DATE : Thu Apr 14 23:41:30 2005
Hi,
I created a subclass of NSWindow that automatically closes the
window after three seconds. The subclass works as it should when
called from a normal objective-C routine/function. However, if I call
it from within a NSThread I create, it will popup but not close. Does
anyone know why it won't work porpperly when call from within an
NSThread?
---------------------------------- Custom NSWindow class
--------------------------------
- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned
int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag
{
NSWindow* result = [super initWithContentRect:contentRect
styleMask:aStyle backing:NSBackingStoreBuffered defer:NO];
[result setLevel: NSStatusWindowLevel];
[self performSelector:@selector(closeSplashScreenPanel)
withObject:nil afterDelay:3];
return result;
}
- (void)closeSplashScreenPanel
{
[self release];
}
---------------------------------- NSThread Stuff
---------------------------------------------
[NSThread detachNewThreadSelector: @selector(MyThread) toTarget:self
withObject:nil];
- (void)MyThread
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
//Programatically Create and display window here
//in my actuall program I have a hole bunch of
stuff running in a while loop
[pool release];
}
Any help would be great,
Dan Yocom
| Related mails | Author | Date |
|---|---|---|
| Dan Yocom | Apr 14, 23:41 | |
| Joshua D. Orr | Apr 15, 00:33 | |
| Dan Yocom | Apr 15, 16:26 | |
| Lindsey Spratt | Apr 15, 17:35 | |
| Joshua Orr | Apr 15, 18:55 | |
| j o a r | Apr 15, 19:50 | |
| j o a r | Apr 15, 21:20 |






Cocoa mail archive

