I am sorry, none of this works :(

-----Original Message-----
From: Conrad Shultz [mailto:con...@synthetiqsolutions.com] 
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 (Cocoa-dev@lists.apple.com)

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

This email sent to arch...@mail-archive.com

Reply via email to