我想把回车键变为TAB键
procedure TForm2.Edit2KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=13 then
key:=TAB键值 ;
end;
1 问一问TAB的ASCII值是多少
2 这样写能实现功能吗?如不能应怎么写呀
procedure TForm2.Edit2KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=13 then
key:=TAB键值 ;
end;
1 问一问TAB的ASCII值是多少
2 这样写能实现功能吗?如不能应怎么写呀
Shift: TShiftState);
begin
if Key = VK_Return then
begin
Key := 0;
if ((ActiveControl is TCustomGrid) or (ActiveControl.Parent is TCustomGrid)) then
begin
Key := VK_TAB;
TMYGrid(ActiveControl as TCustomGrid).KeyDown(Key, Shift);
end else
Perform(CM_DIALOGKey, VK_TAB, 0);
end;
end;procedure TCustomMISForm.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
FKey := KEy;
FShift := Shift;
end;procedure TCustomMISForm.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
TabToEnter(FKey, FShift);
end;
end;
begin
if Key = #13 then
begin
Key := #0;
key :=VK_TAB;//报错
end;
end;
我这么写怎么报错呀
begin
Key := #0;
Keybd_Event(VK_TAB, MapvirtualKey(VK_TAB, 0), 0, 0);
end;
begin
if Key = #13 then
begin
Key := #0;
Keybd_Event(VK_TAB, MapvirtualKey(VK_TAB, 0), 0, 0);
Form2.KeyPreview := True ;
end;
end;
我有几个EDIT键但有几个EDIT鍵的顺序与Tab的顺序不一样,我用的是Delphi5
是怎么回事呢!!
procedure TForm2.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
key :=VK_TAB;//报错
end;
end;
我这么写怎么报错呀
===================
当然会报错呀Key的类型是Char,
VK_TAB是Word型
把key :=VK_TAB;//报错
改为:
Key := Chr(VK_TAB);//不报错
PostMessage(Activecontrol.Handle, WM_KeyDown, VK_TAB ,0);
begin
Key := #0;
Keybd_Event(VK_TAB, MapvirtualKey(VK_TAB, 0), 0, 0);
end;
Form1.KeyPreview := True ;