Hi,
You first have to compute the character index where you need to place the cursor, then create a range with zero length and location = character index, Then get the editor (NSText object) for the text field, you can get one by calling NSWindow's
"- (NSText *)fieldEditor:(BOOL)createWhenNeededforObject:(id)anObject"
and passing your NSTextField object as anObject
Then eventually call "- (void)setSelectedRange:(NSRange)aRange" on the text object by passing the range you computed in the first step.

Hope this helps,
Chaitanya

On 13-Aug-08, at 7:02 AM, [EMAIL PROTECTED] wrote:

How can I programmatically position the cursor to an arbitrary position with a NSTextField?

For example, placing a cursor within the parentheses '('...')' of a phone number?

Regards,

Ric.
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/chaitanya%40expersis.com

This email sent to [EMAIL PROTECTED]

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to