Re: Selected text in NSTextField
Re: Selected text in NSTextField
- Subject: Re: Selected text in NSTextField
- From: Conrad Shultz <email@hidden>
- Date: Tue, 31 Jan 2012 10:02:41 -0800
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