set keypreview pada form menjadi true
procedure TForm1.FormCreate(Sender: TObject);
begin
keyPreview := true;
end;
/////////cara 1//////////////////////////
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0; PostMessage(Handle, WM_NEXTDLGCTL, 0, 0);
end;
end;
///////////////////////////////////////////cara 2//////////////////////////////////
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
KodeScan : Integer;
begin
if Key = VK_RETURN then
begin
Key := 0; { hilangkan bunyi beep }
KodeScan := Lo(MapVirtualKey(VK_TAB,0));
keybd_event(VK_TAB, KodeScan, 0,0);
end;
end;
Tidak ada komentar:
Posting Komentar