Re: Launched window not activating
Re: Launched window not activating
- Subject: Re: Launched window not activating
- From: j o a r <email@hidden>
- Date: Mon, 11 Apr 2005 20:59:10 +0200
I wouldn't use a thread for this purpose alone - it doesn't smell right.
I would assume that you perform the open+download+close operation in
one event loop? that is probably why the window doesn't behave like
you would expect. Try to just launch your download operation on a
timer. Something like this:
- (void) myConnectionCallback:(id) sender
{
[self doTheStuffToOpenTheWindow];
[self performSelector: @selector(runDownloadOperation)
withObject: nil afterDelay: 0.0];
}
- (void) runDownloadOperation
{
// do whatever you do when you download
[myWindow close];
}
And, if the download operation is a long one (long == more than 1 - 2
second), you should probably place it on a thread, in which case this
trick with the timer won't be necessary at all. Having the download
operation on a thread seems like a much better design than the other
way around. Try to keep all UI operations on the main thread, and all
other lengthy operations on secondary threads.
j o a r
On 11 apr 2005, at 20.31, Ken Tozier wrote:
Thanks Lorenzo. Threading did the trick!
I'm a little confused as to why threading is necessary though. Is
it always required to open nib files other than the main nib inside
their own thread? If not, why was it necessary for this instance.
I'm not doing anything fancy inside my code, just opening a window
with [NSWindowController initWithWindowNibName:@"nibName" owner:
self];
Do you know if there is any documentation that spells out these
types of hidden gotchas?
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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