manage accented chars from keyboard
Posted: Sat May 30, 2015 3:03 pm
I'm looking to manage the accented letters input from keyboard.
I wrote a function that works but I'm wondering if there is not a simplest or more elegant way
Best regards
Jean-Marc
I wrote a function that works but I'm wondering if there is not a simplest or more elegant way
Code: Select all
local sKeyUpSpec
on rawkeyup pKey
if the uMyjeu of this cd = "TexteAvecTrous" then
if pKey is in "43,61,93" then--- "43 graveOnly,61 circumflex, 93 trema"
put pKey into sKeyUpSpec
end if
end if
pass rawkeyup
end rawkeyup
on keyUp pKey
answer getLetterAccentSpec(pKey)
ClearsKeyUpSpec
end keyUp
function getLetterAccentSpec pKey,pSpec
put "61,93,43" into tAccentSpec
if sKeyUpSpec <> empty then
put itemoffset(sKeyUpSpec,tAccentSpec) into tAccentSpecFound
if tAccentSpecFound = 0 then return pKey
end if
put "aâä,eêë,iîï,oôö,uûüù" into tLetterTarget
put itemoffset(pkey,tLetterTarget) into tLetterFound
if tLetterFound = 0 then return pKey
put char (tAccentSpecFound + 1) of item tLetterFound of tLetterTarget into tLetterAcc
return tLetterAcc
end getLetterAccentSpec
on ClearsKeyUpSpec
put empty into sKeyUpSpec
end ClearsKeyUpSpec
Jean-Marc