Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Set max chars for Unicode Edit Text control?



On 7/26/04 9:26 AM, Scott Thompson didst favor us with:

>> Unfortunately, key filters are not Unicode saavy. That's why I
>> suggested
>> using a kEventTextInputUnicodeForKeyEvent handler, which is the
>> recommended
>> approach.
>
> In this case the key filter doesn't have to be Unicode savvy. It
> simply has to retrieve the unicode text from the control at each
> keystroke and determine whether any more text can be added to the
> string. It really doesn't care what the incomming keystroke's value
> is.

The reason I mentioned that is that I know there are multiple ways for users
to enter text, more than just typing and pasting. I don't know all the
details about how all of the work, so I'm reluctant to assume how all of the
interact with a key filter. If someone at Apple wants to clarify that and
alleviate my concerns, that would be cool.
>
>> Note that a validation proc isn't called until after the text has been
>> pasted. At best this means your application would be allowing a paste which
>> has no effect, which as user experiences go is less than ideal. Better to
>> disable the Paste command if you don't want to allow pasting of what's on the
>> Clipboard.
>
> I couldn't disagree more. Disabling the paste command is far more
> restrictive than allowing the paste. The user who knows that the text
> field can only hold five characters should still be given the option of
> copying and pasting five characters into the field. Good user
> interface design considerations would allow the user to paste and, in
> the case of an error, explain why the paste is invalid.

This depends on the nature of the data being pasted and the situation. If I
attempt a Paste into a text field, most applications will disable the Paste
command if the data on the Clipboard isn't text, for example. They don't
enable the Paste command and then respond to an attempt to paste by posting
an alert that there's no text to paste. I know this isn't exactly the same
situation, but it's not altogether different either.

> Perhaps the resulting dialog could offering the user the option of truncating
> the pasted text to the desired length.

I don't know anything about the application, of course, but if I copied a
string of 10 characters to the Clipboard, 99% of the time I wouldn't want
only one or two of them pasted. If I'm trying to paste 10 characters into a
text field which only allows five, then either I don't understand that it
only allows five, or the text on the Clipboard isn't what I thought it was.
This is a judgement call, but as a user, I see no significant advantage to
implementing "partial-pasting" code, and it certainly isn't standard. For
example, I have some text fields in my application into which you can enter
type and creator codes. If you copied four characters to the Clipboard and
tried to paste them after three existing characters in one of those fields,
it wouldn't make any sense to offer to do a partial paste. It might make
sense for this field in your application, but it's not an approach I'd
recommend I general. Just my $0.02.

Larry
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: Set max chars for Unicode Edit Text control? (From: Scott Thompson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.