• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Selected text in NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NSPopUpButton Binding Frustration (From: Seth Willits <email@hidden>)
 >Re: NSPopUpButton Binding Frustration (From: Keary Suska <email@hidden>)
 >Re: NSPopUpButton Binding Frustration (From: Leo <email@hidden>)
 >Selected text in NSTextField (From: Dany Golubitsky <email@hidden>)

  • Prev by Date: Re: Block Confusion...
  • Next by Date: Re: How do you run an app on the device with Instruments?
  • Previous by thread: Selected text in NSTextField
  • Next by thread: Re: A documetation suggestion (was Re: Cocoa et al as HCI usability problem)
  • Index(es):
    • Date
    • Thread