RE: Selected text in NSTextField
RE: Selected text in NSTextField
- Subject: RE: Selected text in NSTextField
- From: Dany Golubitsky <email@hidden>
- Date: Wed, 01 Feb 2012 08:19:06 -0500
- Acceptlanguage: en-US
- Thread-topic: Selected text in NSTextField
I am sorry, none of this works :(
-----Original Message-----
From: Conrad Shultz [mailto:email@hidden]
Sent: Tuesday, January 31, 2012 20:03
To: Dany Golubitsky
Cc: Cocoa Development
Subject: Re: Selected text in NSTextField
On 01/31/2012 12:14 AM, Dany Golubitsky wrote:
> Hello Everyone!
>
> I am interested in opening NSAlert window that includes editable text
> field. I would like that the text field will be immediately in focus
> and all characters will be selected. Meaning that the user can
> immediately start to type another name if he interested.
...
> I also tried to use becomeFirstResponder - still, you need to click
> inside the text field in both cases in order to start editing.
-becomeFirstResponder does not do what you think it does... read the class documentation for NSResponder. The selector is misleadingly named.
What I would try (i.e. I have not tested this), is one of:
[[alert window] makeFirstResponder:myTextField]; [[alert window] setInitialFirstResponder:myTextField];
(I'm not clear on the life cycle for the NSAlert's -window object, so I don't know whether you can actually get at it to set its initial first responder before it's displayed.)
--
Conrad Shultz
Synthetiq Solutions
www.synthetiqsolutions.com
_______________________________________________
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