Re: Determining if a NSTextField is selected....
Re: Determining if a NSTextField is selected....
- Subject: Re: Determining if a NSTextField is selected....
- From: Alan Nilsson <email@hidden>
- Date: Thu, 30 Jan 2003 22:33:26 -0800
Look at NSControl method:
-(NSText*)currentEditor
This will return the window's current field editor if the control is first
responder (*selected*) otherwise it will return nil.
The only problem is that you have to loop through all the text fields until
you find the one in focus. I don't know of a method that will take you
directly there (though they may be a way. You may be able to ask the window
for its field editor then ask the field editor which control it is editing,
but I don't think so - can't remember for sure)
Alan
on 1/30/03 4:15 PM, Kevin Elliott at email@hidden wrote:
>
Greetings all, I've got what sounds like a simple problem that I
>
haven't been able to figure out. I've got a window with number of
>
NSTextFields and an NSStepper in it. I'm trying to figure out is how
>
to determine which of those NSTextFields is currently "selected" (the
>
text is highlighted and/or it has the current cursor) inside the
>
NSSteppers action message. Nothing I've tried seems to work.
>
>
Neither NSTextField, nor it's super classes have an
>
"isActiveSelection" method. I've tried using NSTextField's "-
>
(BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText
>
*)fieldEditor"
>
and "- (BOOL)control:(NSControl *)control
>
textShouldEndEditing:(NSText *)fieldEditor
>
" to track which contol is active, but they don't seem to be called
>
for selection changes, only when actual input happens.
>
>
What am I missing?
_______________________________________________
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.