Can one permanentaly change a text field's case to capitals?

Ken Ray kray at sonsothunder.com
Sun Jan 29 23:20:12 EST 2006


On 1/29/06 9:28 PM, "Sarah Reichelt" <sarah.reichelt at gmail.com> wrote:

> On 1/30/06, Stgoldberg at aol.com <Stgoldberg at aol.com> wrote:
>> Does anyone know if there is a way to change the type in a field to capital
>> letters and keep it that way as a property whenever one types into the field?
>> I know that the "Text Formatting" option of a text field has a "Change Case"
>> option to change the text into capital letters during development.   However,
>> can one permanently set this as a field's property so that whenever one types
>> in the field it will type as capital letters?   Thanks.
>> Steve Goldberg
> 
> Put this into the script of the field:
> 
> on keyUp
>    put toUpper(me) into me
>    pass keyUp
> end keyUp

Unfortunately this has the unintended effect of moving the insertion point
at the beginning of the field each time, which also makes it scroll back to
the top. Also, it works to upper-case the entire field, instead of just the
characters being typed (not a big deal for fields with small amounts of
text, but can be an issue if you have pages of text in a field.

This revised handler takes care of these things:

on keyDown pKey
   put toUpper(pKey) into the selection
end keyDown


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list