怎麼在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;