程序要求用enter行使和tab同样的功能,下边的程序可以实现,procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
key:=#0;
perform(wm_nextdlgctl,0,0);
end;
end;但因为字段比较多,所以想定义为一个通用的过程或者函数;或着还有更好的方法。
各位高手,请多指教
begin
if key=#13 then
begin
key:=#0;
perform(wm_nextdlgctl,0,0);
end;
end;但因为字段比较多,所以想定义为一个通用的过程或者函数;或着还有更好的方法。
各位高手,请多指教
procedure MyKeyPress(Sender:TObject;Var Key:Char);
begin
if key=#13 then
begin
key:=#0;
perform(wm_nextdlgctl,0,0);
end;
end;
再在程序中写
edit1.OnKeyPress:=MyKeyPress;
..
即可
2 你在edit的处理里编写,然后生成新类(控件),其他edit继承之
3 up一下楼上个人推荐 2
TForm1.EditKeyPress(Sender: TObject; var Key: Char);
//此处EditKeyPress不是Edit1KeyPress
begin
if key=#13 then
begin
key:=#0;
perform(wm_nextdlgctl,0,0);
end;
end;然后需要此功能的TEdit的OnKeyPress事件指向此事件!
(在Events页的OnKeyPress栏的下拉框中选择TForm1.EditKeyPress)
to 76liujing(靖):你的方法我还没有试,不过还是谢谢你。
对回复的各位其他高手同时表示感谢!