I have a form with a TDBGrid and TClientDatabase.
I want to allow using the UpArrow or DownArrow to navigate in the database no matter which control has focus.
I set the Form.KeyPreview := true
This is the Form.OnKeyPress
procedure TfrmMain.FormKeyPress(Sender: TObject; var Key: Char);
var Direction : Integer;
begin
Direction := -1;
if Key = VK_UP then Direction := 1; {Previous}
if Key = VK_DOWN then Direction := 0; {Next}
if Direction <> -1 then
begin
if Direction = 0 then cds1.Next else cds1.Prior;
NextRecord; {Processes AfterScroll event}
end;
end;
This gives me an error E2008 Incompatible types
What am I doing wrong?