Can one permanentaly change a text field's case to capitals?
Sarah Reichelt
sarah.reichelt at gmail.com
Mon Jan 30 00:42:28 EST 2006
> > 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
>
Oops, good catch Ken. I forget about that.
I had to make a quick fix to a program at work one day and made a
very similar mistake which had the effect of making everything come
out backwards. If they typed "today", they got "yadot"! I got a lot of
teasing about that one :-)
Sarah
More information about the use-livecode
mailing list