新手问题?(100分)

  • 主题发起人 主题发起人 彤彤
  • 开始时间 开始时间

彤彤

Unregistered / Unconfirmed
GUEST, unregistred user!
数据录入时,请问如何:按回车,光标自动跳到下一字段。
 
在数据控件的OnKeyPress事件中拦截vk_return,把该数据控件的数据指向下一记录
 
在 onkepress 事件中写:
if key = #13 Then //或者if key = vk_return
Begin
(下一个控件).SetFouce;
End;
 
delphi.mychangshu.com或者www.playicq.com这两个网站
有一个控件专门针对这个功能的.你去下吧
 
OnKeyDown事件里面写这么一句
case key of
VK_RETURN:
begin
key:=0;
if 所在字段索引<字段总数 then
begin
当前字段索引:=当前字段索引+1;
end;
END;
 
My God!
这问题问了N*N遍了!
 
在form的 onkepress 事件中写:
if key = #13 Then //或者if key = vk_return
Begin
(下一个控件).SetFouce;
End;
 
前辈写的,希望能帮你,因为我也是新手呀
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;
 
搜索一下以前的贴子吧,很多的。
 
建议搜索,即省了分
又来的快[:)]
 
后退
顶部