On Wed, 2 Jul 2008 00:20:53 -0400, Moses Hall <[EMAIL PROTECTED]> said:
>Hi folks,
>
>Here's a problem I'm having under Tiger, developing an LSUIElement
>application (Input Method server -- it's the UI for IPA Palette
>[www.blugs.com/IPA]). I have an NSTabView, one of whose panes has a
>search field which is an NSTextField subclass (note that the same
>problem occurs if I use an NSTextField). I want to make this field
>the first responder when the "Search" tab is chosen. Oddly, it does
>not become first responder the first time the pane is selected. It
>does not become key, and does not accept text (unless clicked on). If
>I move to a different tab and come back, then I get the desired
>result: the focus ring is there and I can type into the field.
>
>This is happening inside an NSPanel subclass...
>
>@implementation IPAPanel
>-(BOOL)canBecomeKeyWindow {return YES;}
>-(BOOL)canBecomeMainWindow {return NO;}
>-(void)awakeFromNib
>{
>   [self setHidesOnDeactivate:NO];
>   [self setBecomesKeyOnlyIfNeeded:YES];
>}
>@end
>
>Here is my tab switch delegate method:
>-(void)tabView:(NSTabView*)tv didSelectTabViewItem:(NSTabViewItem*)item
>{
>   NSLog(@"first responder WAS %@", [_window firstResponder]);
>   if ([[item identifier] isEqual:@"Search"])

What's the purpose of this test? Is it necessary? Is it working? Try putting
an NSLog inside the test to see whether it is passing/failing when you think
it should be.

>   {
>     [_window makeKeyWindow];
>     [_window makeFirstResponder:_searchText];
>   }
>   NSLog(@"first responder: %@", [_window firstResponder]);
>}

m.

-- 
matt neuburg, phd = [EMAIL PROTECTED], <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: <http://tinyurl.com/2rh4pf>
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>



_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to