unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key=#9 then
begin
Key:=#13;
Edit3.SetFocus;
end;
if Key=#13 then
begin
Edit3.SetFocus;
end;
end;end.
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key=#9 then
begin
Key:=#13;
Edit3.SetFocus;
end;
if Key=#13 then
begin
Edit3.SetFocus;
end;
end;end.
解决方案 »
- IDHTTP.POST 上传文件时无法触发OnWork事件?
- 权限系统的设计 ---来源二十一世纪IT培训教材www.21centuryit.com
- 如何禁止ADOquery1.ReQuery后记录位置的变化?
- 如何通过combobox来获得数据类型
- DBGridEh问题
- 在delphi7中没有TserverSocket控件,是安装那个包可以把这个装上呢?或者怎么样在delphi7装上这个控件?
- 高手帮忙??Install Shield打包时候,怎么样才能在程序安装的时候自动建立数据库?
- 数据更新问题?
- 怪问题,我用DBgrid作为输入界面,输入几条记录后,突然其中的几条记录自动被重复一次,后台数据库表中看输入的记录又是正常的?为什么?
- 用access数据库,设计完一个表,保存时access提示最好设置一个自动编号的索引ID,这是有什么用的?
- delphi执行脚本的问题
- 一个求1到1000数的阶乘和数 pascal!
begin
if (Key=#13) and (ActiveControl.Tag<>100) then //同时将KeyPreview属性设为True
begin
Key:=#0;
Perform(WM_NEXTDLGCTL,0,0);
end;
end;并设定FORM的//同时将KeyPreview属性设为True,及设置控件的TABORDER次序
我一直是这样用的,绝对没有问题
EDIT3。TABORDER:=2 procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if (Key=#13) and (ActiveControl.Tag<>100) then //同时将KeyPreview属性设为True
begin
Key:=#0;
Perform(WM_NEXTDLGCTL,2,0);
end;
end;
根据控件的taborder顺序跳,在Form的KeyDown事件写上:if Key=13 then
SelectNext(ActiveControl,True,True);
Edit2: TABORDER:=1
Edit3: TABORDER:=2
安你的做法,
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if (Key=#13) and (ActiveControl.Tag<>100) then //同时将KeyPreview属性设为True
begin
Key:=#0;
Perform(WM_NEXTDLGCTL,2,0);
end;
end
好像在EDIT1安下TAB还是不能跳到EDIT3啊
(我看见佛) ,你的方法,只适合用回车,用TAB不行,有没有别的方法啊??
高手帮帮啊