Kod: Tümünü seç
procedure TForm4.ListviewKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Ord(Key) >= 96) and (Ord(Key) <= 105) then
begin
Edit1.Tetx:= GetCharFromVKey(Key);
end;
end;
function TForm4.GetCharFromVKey(vkey: Word): string;
var
keystate: TKeyboardState;
retcode: Integer;
begin
Win32Check(GetKeyboardState(keystate));
SetLength(Result, 2);
retcode := ToAscii(vkey, MapVirtualKey(vkey, 0), keystate, @Result[1], 0);
case retcode of
0:
Result := ''; // no character
1:
SetLength(Result, 1);
2:
;
else
Result := ''; // retcode < 0 indicates a dead key
end;
end;