• 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: firstResponder comparison failing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: firstResponder comparison failing


  • Subject: Re: firstResponder comparison failing
  • From: Mark Dawson <email@hidden>
  • Date: Fri, 09 Jun 2006 16:34:12 -0700

>Right away I am suspicious why you want to be polling your user
>interface items to see which is the first responder.  That seems very
>suspect to me.
I have an NSStepper object that controls two NSTextField.  To control the correct field, I have the stepper connected to my controller.  The controller needs to figure out which field has focus/firstResponder inorder to operate on the correct field (and if there is no focus, which field to default to).
>Nevertheless, Apple even provides this example code
>right in the documentation:
>> Listing 1  Determining if a text field is first responder
>> if ( [[[self window] firstResponder] isKindOfClass:[NSTextView
>> class]] &&
>>
>>    [window fieldEditor:NO forObject:nil] != nil ) {
>>
>>         NSTextField *field = [[[self window] firstResponder]
>> delegate];
>>
>>         if (field == self) {
>>
>>             // do something based upon first-responder status
>>
>>         }
This is somewhat simlilar to what I developed; I added an extra check to see if the field editor was a first responder, if so, then go down the path indicated.

Mark
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: firstResponder comparison failing (From: Erik Buck <email@hidden>)

  • Prev by Date: Re: Window alpha problems
  • Next by Date: NSTokenFieldCell limitations?
  • Previous by thread: Re: firstResponder comparison failing
  • Next by thread: [ANN] view hierarchy inspector
  • Index(es):
    • Date
    • Thread