form的keypreview设为true procedure TFrmMain.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if (key = #13) then begin SelectNext(ActiveControl, true, true); end; end;
出现错误:incompatible types!
if int(key)=13 then SelectNext(ActiveControl, true, true);and if ord(key)=13 then SelectNext(ActiveControl, true, true);
procedure TFrmMain.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (key = #13) then
begin
SelectNext(ActiveControl, true, true);
end;
end;
SelectNext(ActiveControl, true, true);and
if ord(key)=13 then
SelectNext(ActiveControl, true, true);