Re: [Q] How can one programatically begin a text editing session in a NSTextField?
Re: [Q] How can one programatically begin a text editing session in a NSTextField?
- Subject: Re: [Q] How can one programatically begin a text editing session in a NSTextField?
- From: Eric Gorr <email@hidden>
- Date: Thu, 5 Feb 2009 12:17:29 -0500
On Feb 5, 2009, at 12:08 PM, Andy Lee wrote:
--Boundary_(ID_M0oYCC145WUCuhpk/sOO1w)
Content-type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
Content-transfer-encoding: 7BIT
On Feb 5, 2009, at 11:33 AM, Eric Gorr wrote:
[myTextField selectText:nil];
Thanks. Unfortunately, that is not quite the desired behavior as it
causes all of the text to be selected and I want to see the blinking
cursor. It did begin a text editing session though, so it is quite
close.
[myTextField selectText:nil];
[[[myTextField window] fieldEditor:NO forObject:_textField2]
setSelectedRange:NSMakeRange(0, 0)];
Excellent!
I wasn't sure what _textField2 was supposed to refer to exactly, so I
tried this instead:
[[textField currentEditor] setSelectedRange:NSMakeRange(0, 0)];
and it worked.
Now, I just need to figure out, based on the location stored in the
NSEvent for the mouse click, where to correctly set the selection.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden