发信人: redfox (Z掉了几乎所有的版...), 信区: BorlandDev
标 题: Delphi编程 -- 1.7 回车替Tab下移控件
发信站: 哈工大紫丁香 (2000年09月01日13:19:48 星期五), 站内信件
回车替Tab下移控件
需要用回车键代替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;
--
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.227.107]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.130毫秒