首页 Delphi 正文
  • 本文约6字,阅读需1分钟
  • 1669
  • 0
举报该广告
cxgrid中回车键光标移到下列

cxgrid中回车键光标移到下列

OptionsBehavior.GoToNextCellOnEnter:=True;

更完善的回车

可以在焦点到了最后一列再回车时有下一行则移到下一行的第一列,没有下一行则新增记录并移到第一列


procedure TK_XSD_Form.cxGrid1DBTableView1EditKeyDown(
  Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem;
  AEdit: TcxCustomEdit; var Key: Word; Shift: TShiftState);
begin
  inherited;
    if Key=VK_RETURN then begin
   if cxGrid1DBTableView1.Controller.FocusedColumnIndex=cxGrid1DBTableView1.VisibleColumnCount-1 then begin
     with cxGrid1DBTableView1.DataController do begin
       if IsEof  then begin   // or (RecNo=RecordCount)
         cxGrid1DBTableView1.DataController.Append;
       end else begin
         cxGrid1DBTableView1.DataController.MoveBy(1);
       end;
       cxGrid1DBTableView1.Controller.FocusedItemIndex:=-1;
     end;
   end;
 end;
end;

📱 扫码关注公众号

公众号二维码

扫描二维码关注我们,获取更多精彩内容
实时更新 · 干货满满

收藏

扫描二维码,在手机上阅读
评论
更换验证码
友情链接