>I'm entering foreign-language data and would like to use ALT keys to enter
>extended characters; for example, ALT-A to enter an "A" with a grave accent.
>I'm trapping for the ALT keys with vchar(), but I can't get SendKeys() to
>send extended characters. Ordinary ASCII works fine, and I can manually
>type extended characters into the field. Any ideas?
Okay, I've figured this one out and I thought I'd let anyone else who is
interested know how. Stephen Knott put me on the right track with an idea
he had, and I've developed it from there. What I do is put all the ALT
keypresses into the first field of a table and all the extended characters
into the second field (called "Extended character"). Then if the user
enters a character with the ALT key down, a TCursor searches for the key
pressed and copies the extended character in the second field onto the
clipboard, and then the character is pasted into the active field. This
avoids using sendKeys() altogether and further allows the user to alter
the ALT-key list by editing the table. Here is the code, placed in the
keyChar() method of the form:
method keyChar(var eventInfo KeyEvent)
var
sKeyChar string
tcExtChar tcursor
endVar
if eventInfo.isPreFilter() then
;// This code executes for each object on the form
if eventInfo.isAltKeyDown() then
disableDefault
sKeyChar = lower(eventInfo.vChar()) ; char() doesn't work if ALT key is down
if eventInfo.isShiftKeyDown() then ; if SHIFT key is down, make character upper case
sKeyChar = upper(sKeyChar)
endIf
if tcExtChars.qLocate(sKeyChar) then
sKeyChar = tcExtChars."Extended character"
sKeyChar.writeToClipboard()
active.action(EditPaste)
endIf
endIf
else
;// This code executes only for the form
endIf
endMethod
--
School of Music I am not called to be successful;
University of Illinois I am called to be faithful.
Urbana, Illinois 61801 USA -- Mother Teresa