Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

McBgnr

macrumors regular
Original poster
Apr 13, 2009
144
0
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

Moderator emeritus
Jun 15, 2000
7,958
7
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

macrumors regular
Original poster
Apr 13, 2009
144
0
I checked my code again and moved this call to the end of the function. It is working now :)

Thanks a bunch.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.