2014年3月30日 星期日

XE5 Firemonkey bug fix for key value in KeyUp/KeyDown event always 0

In XE5 Firemonkey windows/MacOS application, general key value in Keydown/Up event will always get 0

code:
procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word; var KeyChar: Char;
  Shift: TShiftState);
begin
    Memo1.Lines.Add('down : '+IntToHex(Key,2));
end;

procedure TForm1.Edit1KeyUp(Sender: TObject; var Key: Word; var KeyChar: Char;
  Shift: TShiftState);
begin
    Memo1.Lines.Add('up : '+IntToHex(Key,2));
end;


result:
in Windows
in MacOS


After tracing source code, I fix this problem by replace one line in FMX.Platform.Win.pas,
and work fine:

in Windows
in Macos

the solution is easy, just put FMX.Platform.Win.pas/FMX.Platform.Mac.pas which I fixed inside project folder

example & source code:
code download XE5
code download XE7
code download XE8

沒有留言:

張貼留言