View Full Version : NSTextField selecting
djohnson
2004.08.02, 11:17 AM
Anyone know how to select a NSTextField? Basically I need the cursor to go back to a specific field if something happens. Thanks!
Try - (void)selectText:(id)sender (I haven't tried but thats the closest thing I found from apples site)
djohnson
2004.08.02, 12:01 PM
I found that, but could not get it to work yesterday... Also, I found a way to select a Cell, but I could not figure out how to get the cell information from the NSTextField.
GoodDoug
2004.08.03, 11:57 AM
If I read your question right (which is iffy, given how little sleep I've had lately):
You want the keyboard focus to go to a particular text field and for the text to be selected. You'll have to do a two step process - 1) call - (BOOL) becomeFirstResponder on the text filed, then call - (void) selectText: as the poster above points out.
[aTextField becomeFirstResponder];
[aTextField selectText:sender];
and you're done.
djohnson
2004.08.09, 09:39 PM
Thank you!!! :D
For those that need this, change sender to self and it works. :)
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.