• 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
Find which NSTextField is current responder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Find which NSTextField is current responder


  • Subject: Find which NSTextField is current responder
  • From: John Nairn <email@hidden>
  • Date: Tue, 5 Jul 2005 13:38:30 +0200

I needed to find which of my list of NSTextFields (returned by respondingCells) was the current responder bu writing the following code:

- (int)selectedStructureIndex
{
    int i;
    NSArray *rCells=[self respondingCells];
    id obj,firstResponder=[myWindow firstResponder];
    for(i=0;i<[rCells count];i++)
    {   if([rCells objectAtIndex:i]==firstResponder)
            return i;
    }
    return NSNotFound;
}

but it does not work. Even though all potential responders in my window are NSTextFields, the firstResponder of the window is never an NSTextField but rather the NSTextView that is handling editing for the currently selected NSTextField. The problem then is how to find out which NSTextField is the one being edited by that NSTextView that is returned by the window's firstResponder?

---------------
John Nairn (1-801-581-3413, FAX:1-801-581-4816)
Web Page: http://www.mse.utah.edu/~nairn

_______________________________________________
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


  • Prev by Date: Re:Learning online Cocoa programming???
  • Next by Date: Re: How to make Fetched Property SELF constrinat?
  • Previous by thread: Re:Learning online Cocoa programming???
  • Next by thread: Re: Find which NSTextField is current responder
  • Index(es):
    • Date
    • Thread