On 03/02/2012, at 11:39 AM, Dave Fernandes wrote: > Am I trying the right things here?
It should just work if you set the 'initialFirstResponder' outlet to be your text field. No other code needed, except possibly NOT calling -setBecomesKeyOnlyIfNeeded:YES. The docs suggest this is only called the first time the window is shown - for sheets and other dialogs, often they are only hidden rather than discarded when closed, so it might not work for subsequent showing of the dialog, but simply making the view returned by -initialFirstResponder the first responder should work, i.e. [myPanel makeFirstResponder:[myPanel initialFirstResponder]]; when you display the sheet. I'm not sure if the -performSelector stuff is needed - I guess you're trying to ensure that the window is really there and the event loop is running but AFAIK, that's not necessary at least after the first time it is displayed. I usually end up calling my 'dialog set up' method from two places - one in -windowDidLoad, and the other just after -beginSheet…. The two calls are mutually exclusive in the sense that on the first run, the call after beginSheet finds all the outlets nil, so does nothing, and -windowDidLoad is only called the first time. While not super elegant I've never encountered any unreliability with it. --Graham _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com