You want to select the text using the associated text view of the NSTextField 
control.
--
Gary L. Wade (Sent from my iPhone)
http://www.garywade.com/

> On Jul 6, 2015, at 10:54 AM, Richard Charles <rcharles...@gmail.com> wrote:
> 
> 
>> On Jul 6, 2015, at 10:15 AM, Richard Charles <rcharles...@gmail.com> wrote:
>> 
>> I have a NSTextField subclass that selects all of the text when the user 
>> clicks it. This is accomplished by overriding becomeFirstResponder.
>> 
>> - (BOOL)becomeFirstResponder
>> {
>>   BOOL result = [super becomeFirstResponder];
>>   if(result) {
>>       [self performSelector:@selector(selectText:) withObject:self 
>> afterDelay:0];
>>   }
>>   return result;
>> }
>> 
>> http://stackoverflow.com/questions/2195704/selecttext-of-nstextfield-on-focus
>> 
>> This has worked perfectly for years until 10.10 Yosemite. Now when the user 
>> clicks into the text field nothing is selected.
>> 
>> Also the following error will often occur on 10.10 Yosemite when clicking on 
>> the text field.
>> 
>> 2015-07-06 10:09:04.287 MyApp[727:15035] Bad cursor rect event, flags = 256
>> 
>> Does anyone have any insight into what is going on?
>> 
>> Thanks so much.
>> 
>> --Richard Charles
> 
> Update
> 
> The documentation for -[NSTextField selectText:] states "If the receiver 
> isn’t in some window’s view hierarchy, this method has no effect.”
> 
> I have verified that the text field is in the window’s view hierarchy. I have 
> verified that -[NSTextField selectText:] is getting called. (Actually it is 
> getting called twice, once by the frameworks for some reason, and once by 
> me.) Calling the method -[NSTextField isSelectable] returns YES.
> 
> It appears that -[NSTextField selectText:] is broken in 10.10 Yosemite. It 
> just does not work.
> 
> --Richard Charles

_______________________________________________

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