Re: Callbacks, GUI updates and threading
Re: Callbacks, GUI updates and threading
- Subject: Re: Callbacks, GUI updates and threading
- From: Gwynne <email@hidden>
- Date: Mon, 10 May 2004 16:34:19 -0400
On May 10, 2004, at 3:22 PM, Hamish Allan wrote:
For the record: makeWindowControllers is also called before the window
is displayed. I eventually found a working method which appeared on
this list a couple of years back (I did look before I asked, honest!)
courtesy of Simon Stapleton:
http://cocoa.mamasam.com/COCOADEV/2002/10/1/46630.php
----
- (void) windowDidLoad {
// other windowDidLoad code here
[self performSelector:@selector(showSheet:) withObject:nil
afterDelay:0];
}
- (void) showSheet: (id) something {
// Code to show the sheet here
}
This will cause -showSheet: to be called as soon as the app drops into
its runloop, by which point the window should be visible.
----
Also for the record, the reason this works is because
performSelector:withObject:afterDelay: does its job by scheduling an
NSTimer on the current NSRunLoop; when afterDelay is set to zero, the
timer fires as soon as the runloop runs.
-- Gwynne, key to the Code that runs us all
Formerly known as Sailor Quasar.
Email: email@hidden
Web:
http://musicimage.plasticchicken.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.