您现在的位置:首页 >> VCL >> VCL >> 内容

回车键代替TAB键下移

时间:2012/5/30 10:06:36 点击:

  核心提示:需要用回车键代替TAB键下移一个控件时,把KeyPress设为True,加入下列代码拦截击键:Procedure TForm1.FormKeyPress(Sender:Tobject;Var Key:Char);Begin if key=#13 then { 判断是按执行键} if not (Act...

 

需要用回车键代替TAB键下移一个控件时,把KeyPress设为True,加

入下列代码拦截击键:
Procedure TForm1.FormKeyPress(Sender:Tobject;Var Key:Char);
Begin
 if key=#13 then { 判断是按执行键}
 if not (ActiveControl is TDbgrid) Then
 Begin { 不是在TDbgrid控件内}
  key:=#0;
  perform(WM_NEXTDLGCTL,0,0);{移动到下一个控件}
 end else
 if (ActiveControl is TDbgrid) Then{是在 TDbgrid 控
件内}
 begin
  With TDbgrid(ActiveControl) Do
  if Selectedindex<(FieldCount-1) then
  Selectedindex:=Selectedindex+1{ 移动到下一字段}
  else Selectedindex:=0;
 end;
End;

作者:aspnet110 录入:aspnet110 来源:原创
共有评论 3相关评论
发表我的评论
  • 大名:
  • 内容:
本类推荐
  • 没有
本类固顶
  • 没有
  • 盒子文章(www.2ccc.com) © 2024 版权所有 All Rights Reserved.
  • 沪ICP备05001939号