Re: controlTextDidChange, backspace possible?
Re: controlTextDidChange, backspace possible?
- Subject: Re: controlTextDidChange, backspace possible?
- From: "Peter Karlsson" <email@hidden>
- Date: Tue, 14 Sep 2004 15:52:27 +0000
This is what my code looks like at the moment:
-(void)controlTextDidChange:(id)sender
{
if ([[myTexfieldOutlet stringValue] length] == 32)
{
latestString = [myTexfieldOutlet stringValue];
[latestString retain];
}
if ([[myTexfieldOutlet stringValue] length] > 32)
{
[myTexfieldOutlet setStringValue:latestString];
}
}
It seems to work except if I type a character in the middle of a 32
character string, the cursor moves one character to the right for every time
I type a character. I want the cursor to stand still!
It's strange that a common thing like this is so hard in OS X. Why don't
have a field in IB where I just type 32 for length, period!
Peter
From: j o a r <email@hidden>
To: Harilaos Skiadas <email@hidden>
CC: email@hidden, email@hidden
Subject: Re: controlTextDidChange, backspace possible?
Date: Tue, 14 Sep 2004 17:30:02 +0200
To override you need to subclass, and that's something I try to avoid if
possible.
Also, yes, you probably need a custom field editor - as "insertText:" is a
NSTextView method, and Peter asked for a way to limit the string length in
a NSTextField.
j o a r
On 2004-09-14, at 17.19, Harilaos Skiadas wrote:
just wondering, could he also override the insertText:
method to check the length of the string and not send
any text if the string is longer than 32 characters?
If so, where would be the right place to do that?
Would he need a custom field editor?
<< smime.p7s >>
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
_______________________________________________
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