Type in upper case
Éric Chatonet
eric.chatonet at wanadoo.fr
Thu Sep 30 03:32:27 EDT 2004
Le 30 sept. 04, 00:23, ludovic.thebault at laposte.net a crit :
> Hello,
>
> I want the user type in upper case.
> I've made a script with the keyup handler to convert lower letter in
> upper letter, but the conversion is visible.
>
> How make the conversion in the keydown handler ?
Bonjour Ludovic,
It's a pity but toUpper rev function is unaware of the existence of
latin vowels :-)
You are french. So you need to uppercase them:
on keyDown pKey
if the selectedChunk = empty then pass keyDown
put InternationalToUpper(pKey) into the selectedChunk -- Æ
end keyDown
--------------------------
function InternationalToUpper pKey
local tASCIIVal
-----
put charToNum(pKey) into tASCIIVal
if tASCIIVal >= 97 and tASCIIVal <= 122 then
return numToChar(tASCIIVal - 32)
else
return RightASCIIValue(tASCIIVal) -- Æ
end if
end InternationalToUpper
--------------------------
function RightASCIIValue pASCIIVal
-- trap latin accented vowels
put item itemOffset(pASCIIVal,"141,142,143,136,137,144,207") \
of "130,131,233,203,229,230,206" into tNewValue
if tNewValue = empty then return numToChar(pASCIIVal)
return numToChar(tNewValue)
end RightASCIIValue
Note that Klaus Major formulation works fine unless a selection was
done in the field.
Hope this helps.
Contact me off list if needed.
Amicalement,
ric Chatonet
24, Boulevard de Port-Royal
75005 Paris
Fixe : 33 1 43 31 77 62
Mobile : 33 6 20 74 50 89
More information about the use-livecode
mailing list