• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Setting focus to text field in drawer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Setting focus to text field in drawer
      • From: Arthur Clemens <email@hidden>
References: 
 >Re: Setting focus to text field in drawer (From: Arthur Clemens <email@hidden>)

  • Prev by Date: Examples of creating custom controls
  • Next by Date: Re: Services, Threads and User Interface
  • Previous by thread: Re: Setting focus to text field in drawer
  • Next by thread: Re: Setting focus to text field in drawer
  • Index(es):
    • Date
    • Thread