OnKeyDown event does not work on win32
Original Reporter info from Mantis: sekelsenmat
-
Reporter name: Felipe Monteiro de Carvalho
Original Reporter info from Mantis: sekelsenmat
- Reporter name: Felipe Monteiro de Carvalho
Description:
Given the following method linked to the OnKeyDown event of a Window:
procedure TMainWindow.HandleKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
case Key of
VK_LEFT: Mouse.CursorPos := Point(Mouse.CursorPos.X - 5, Mouse.CursorPos.Y);
VK_RIGHT: Mouse.CursorPos := Point(Mouse.CursorPos.X + 5, Mouse.CursorPos.Y);
VK_UP: Mouse.CursorPos := Point(Mouse.CursorPos.X, Mouse.CursorPos.Y - 5);
VK_DOWN: Mouse.CursorPos := Point(Mouse.CursorPos.X, Mouse.CursorPos.Y + 5);
VK_PRIOR: Mouse.CursorPos := Point(Mouse.CursorPos.X, Mouse.CursorPos.Y - 50); // Page Up
VK_NEXT: Mouse.CursorPos := Point(Mouse.CursorPos.X, Mouse.CursorPos.Y + 50); // Page Down
VK_ESCAPE: HideWindow(Self);
VK_RETURN: HideWindow(Self);
{*******************************************************************
* The sender parameter is used to tell the procedure to enlarge or decrease the Len size
*******************************************************************}
VK_ADD: vConfigurations.iMagnification := vConfigurations.iMagnification + 0.5;
VK_SUBTRACT: vConfigurations.iMagnification := vConfigurations.iMagnification - 0.5;
end;
// Hard limits for the magnification
if vConfigurations.iMagnification = 0.5 then vConfigurations.iMagnification := 1.0
else if vConfigurations.iMagnification > 16 then vConfigurations.iMagnification := 16;
vGlass.Invalidate;
end;
Pressing the any key has no effect at all. Adding Key:=0 doesn´t help.
Works on Delphi 5.
Mantis conversion info:
- Mantis ID: 1617
- OS: Mandrake Linux and Windows XP
- OS Build: 10.2 and 5.1
- Platform: x86 intel
- Version: 0.9.11 (SVN)
- Target version: 1.0.0
- LazTarget: 1.0