Re: Setting focus to text field in drawer
Re: Setting focus to text field in drawer
- Subject: Re: Setting focus to text field in drawer
- From: Thomas Harrington <email@hidden>
- Date: Tue, 12 Aug 2003 10:19:48 -0600
On Monday, August 11, 2003, at 02:18 AM, Arthur Clemens wrote:
In SearchTextField.m:
- (BOOL)becomeFirstResponder
{
if ( [[[self cell] textColor] isEqualTo:[NSColor grayColor]] ) {
// Save current record first
[self sendAction:@selector(saveChangesToRecord) to:[self
target]];
[self sendAction:@selector(updateUI) to:[self target]];
[[self cell] setTitle:@""];
[[self cell] setTextColor:[NSColor blackColor]];
[self setNeedsDisplay:YES];
}
return YES;
}
I found out that by removing the overridden becomeFirstResponder in the
text field, publiclook's suggestion of
[[_searchField window] makeKeyAndOrderFront:nil];
[[_searchField window] makeFirstResponder:_searchField];
does work. I removed the function calls from becomeFirstResponder of
the text field to the becomeFirstResponder of the field editor.
So it all functions now as it should. But I don't know if I should have
written the text field's becomeFirstResponder differently, or that I
shouldn't have overridden text field's becomeFirstResponder.
Would it make any difference if your becomeFirstResponder called [super
becomeFirstResponder] somewhere? It looks like you wanted to add to
the default behavior, but instead you end up replacing it, bypassing
anything that any of the superclasses might normally do in this method.
--
Tom Harrington
email@hidden
_______________________________________________
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.