PDA

View Full Version : NSTextField SetFocus




McBgnr
Apr 21, 2009, 06:21 AM
Hello,

I want to set focus on NSTextField programatically.

I have tried
[myWindow makeFirstResponder:myTextField];

Though this is highlighting the text field with a blue border but not showing the carot symbol inside it and I can directly type in words into it.

How can I get it ready to accept input thru a program?



kainjow
Apr 21, 2009, 11:59 AM
This should work. If it has the blue focus ring, that means it's the first responder. I don't think the text cursor will always show right away, but you should be able to start typing. Maybe something else is going on in your code?

McBgnr
Apr 21, 2009, 12:59 PM
I checked my code again and moved this call to the end of the function. It is working now :-)

Thanks a bunch.