Re: (ALT + ENTER) in NSTextField
Re: (ALT + ENTER) in NSTextField
- Subject: Re: (ALT + ENTER) in NSTextField
- From: Jack Nutting <email@hidden>
- Date: Tue, 13 Sep 2005 10:38:14 +0200
On 9/13/05, Harmanpreet Bachal <email@hidden> wrote:
>
> Hi All,
>
> I have a NSTextField as a subject filed in my application. In windows a
> multi line text field is not permitted but in mac if we use (ALT + ENTER)
> we get multiline text. What is the purpose of (ALT + ENTER). Is it a
> feature or bug??
> If we can restrict (ALT + ENTER) then how?
It's definitely a feature. Comes in very handy if, for instance, you want to
search for a string occuring at the end (or beginning) of a line, using a
standard Find panel.
As for restricting it, there are several ways. The simplest to implement is
probably just to check the string the user entered before it goes into your
model, replacing all occurrences of '\n' with ' '. If you want to really
stop it at the source, while the user is typing, you'll probably want to
create a subclass of NSFormatter, and implement one or both of the
isPartialStringValid:... methods.
--
// jack
// http://www.nuthole.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden