Find which NSTextField is current responder
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