Mega Code Archive

 
Categories / Delphi / Examples
 

Use arrow keys to move between controls

Title: Use arrow keys to move between controls Question: Use arrow keys to move between controls Answer: procedure TForm1.FormKeyDown( Sender : TObject; var Key: Word; Shift : TShiftState ) ; var Direction : Integer; begin Direction := -1; case Key of VK_DOWN, VK_RETURN : Direction := 0; {Next} VK_UP : Direction := 1; {Previous} end; if Direction -1 then begin Perform(WM_NEXTDLGCTL, Direction, 0) ; Key := 0; end; end;