Cita:
Empezado por AgustinOrtu
No me percate de que estabamos hablando de Lazarus
|
En un momento me imaginé que venía por ese lado el tema.
Cita:
Empezado por AgustinOrtu
Acabo de hacer esta sencilla prueba y me funciona bien:
Código Delphi [-]uses
LCLType;
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_NUMPAD0 then
ShowMessage('VK_NUMPAD0');
if Key = VK_MULTIPLY then
ShowMessage('VK_MULTIPLY');
end;
Obvio que es necesario tener KeyPreview a True
|
¿Dónde iría el "uses LCLType;"?, porque lo puse inmediatamente antes del procedure tal cual lo tienes ahí y cuando compilo me pone:
"
Fatal: Syntax error, "BEGIN" expected but "USES" found"
Actualmente el código está así:
Código Delphi
[-]
uses LCLType;
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if key = 96 then
begin
btn0.Click;
end;
if key = 97 then
begin
btn1.Click;
end;
if key = 98 then
begin
btn2.Click;
end;
if key = 99 then
begin
btn3.Click;
end;
if key = 100 then
begin
btn4.Click;
end;
if key = 101 then
begin
btn5.Click;
end;
if key = 102 then
begin
btn6.Click;
end;
if key = 103 then
begin
btn7.Click;
end;
if key = 104 then
begin
btn8.Click;
end;
if key = 105 then
begin
btn9.Click;
end;
if key = 08 then
begin
btnBS.Click;
end;
if key = 106 then
begin
btnMultiplicacion.Click;
end;
if key = 107 then
begin
btnSuma.Click;
end;
if key = 109 then
begin
btnResta.Click;
end;
if key = 110 then
begin
btnComa.Click;
end;
if key = 111 then
begin
btnDivision.Click;
end;
if key = 13 then
begin
btnIgual.Click;
end;
end;
Gracias.