Re: Working with NSTextFields
Re: Working with NSTextFields
- Subject: Re: Working with NSTextFields
- From: Alex Hall <email@hidden>
- Date: Tue, 15 Sep 2015 16:38:04 -0400
> On Sep 15, 2015, at 13:20, Jens Alfke <email@hidden> wrote:
>
>
>> On Sep 15, 2015, at 9:11 AM, Alex Hall <email@hidden> wrote:
>>
>> * When I call myField.stringValue="some text", that string ("some text") appears as expected, but it's highlighted. That means that, when the user starts typing, it disappears, defeating the purpose of the app putting it there for the user in the first place.
>
> That’s the standard behavior for text fields. It lets the user tab through a dialog box and either accept the default value or quickly type in a new one.
Makes sense. In this app, though, I want to put focus on the field (that is, becomeFirstResponder()) then put the cursor after the text the app inserted, letting the user continue typing after it without typing *over* it.
>
>> * My field currently doesn't allow spellchecking or auto-correct, but I want it to. I don't see that option anywhere in the inspectors, for the field or its child cell.
>
> This is probably a side effect of the fact that all text fields (and text cells in general) in the window share the same NSTextView, called the “field editor”. So by default they’re using the characteristics of that view.
>
> You can override either of those behaviors, but it sounds like you may want to use an NSTextView instead of an NSTextField in your UI, since its behavior isn’t typical and you want to enable extra features.
I'll look into that. I didn't realize a text view could be editable. Thanks.
>
> —Jens
>
--
Have a great day,
Alex Hall
email@hidden
_______________________________________________
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