怎么在cxGrid中的某一个单元格回车?
怎么在cxGrid中的某一个单元格回车?而且回车后还是在该列上?
步骤:
1:设置需要回车的字段。程序运行时需要让cxGrid获得焦点时,该字段就要为选中状态。
procedure TForm1.cxGrid1Enter(Sender: TObject); begin Self.cxGrid1DBTableView1.GetColumnByFieldName(‘收费金额’).Focused:=True; end;
2:
procedure TForm1.cxGrid1DBTableView1KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin
if cxGrid1DBTableView1.DataController.IsEOF then begin Self.Button1.SetFocus; Exit; end;//如果已经是最后一行了,自然转出输入焦点
cxGrid1DBTableView1.DataController.GotoNext; end; end;