I see. I've been having trouble forcing an NSTextField to get focus in document-modal sheets, and I wondered whether NSPanel/NSWindow should make a difference. (Experimentally it does not.)
I found on Snow Leopard that the following always worked: [sheetController window]; // load the NIB [sheet performSelector:@selector(makeFirstResponder:) withObject:myTextField afterDelay:0.]; [NSApp beginSheet:sheet modalForWindow:docWindow ... On Lion, it works for some sheets, but not others (very reproducible for any given sheet). Sometimes if the performSelector delay is > 0.8 sec, it works, but not always. The problem cases are always with NSTextField or its subclasses inside of NSTabViews. I also tried setting the sheet's initial first responder to be the text field and then calling: [sheet makeFirstResponder:sheet]; [sheet performSelector:@selector(selectNextKeyView:) withObject:nil afterDelay:0.]; That also works in some cases and not others on Lion. Am I trying the right things here? On 2012-02-02, at 7:10 PM, Graham Cox wrote: > NSPanel inherits NSWindow. If you look at the methods that NSPanel adds to > NSWindow, it's really a very small set. > > It allows: > > a) the window to be a floating window > > b) it allows the window to not become key "unless necessary", which is very > useful to prevent a floater from stealing focus away from whatever it floats > over, unless the user explicitly clicks in a text field, for example. > > c) it allows the window to be receive events when run modally. > > I think there are also some minor appearance differences. > > That's all, so if your needs are not addressed by any of these features, you > may as well use NSWindow. > > > --Graham > > > > > On 03/02/2012, at 10:51 AM, Dave Fernandes wrote: > >> I'm still a little unclear on when to use an NSWindow and when to use an >> NSPanel. I thought you used an NSPanel if you did *not* want it to become >> key. But for input, you do want it to become key, don't you? I'm sure I've >> missed some basic Cocoa 101 here, but I found the docs "clear as mud" on >> this. >> >> Dave > _______________________________________________ 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