TDBGrid中用Enter仿真Tab键盘

王朝网络·delphi·作者佚名  2006-01-08
宽屏版  字体: |||超大  

procedure TForm1.FormKeyPress(Sender: TObject; var Key:

Char);

begin

if Key = #13 then //如果是一个Enter键盘

begin

if not (ActiveControl is TDBGrid) then //如果当前的控件不是TDBGrid

begin

Key := #0;

Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }

end

else if (ActiveControl is TDBGrid) then //在TDBGrid中

begin

with TDBGrid(ActiveControl) do

begin

if selectedindex < (fieldcount -1) then //如果不是最后一个字段

selectedindex := selectedindex +1

else

selectedindex := 0;

end;

end;

end;

end;

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有