delphitcxgrid

cxGrid new record on last field Enter


I'm struggling to make a TcxGrid to append a new record whenever the user presses Enter key on last field of the current record, however I didn't find any property that might help me achieve this.

I tried setting the OnKeyDown event of the grid view(TcxGridDBTableView), with the following code

if Key = VK_RETURN then
  if PaymentViewBetragNetto.Focused then
    PaymentView.DataController.AppendRecord;

however the code is not executed for some reason...

Any idea on how to append record on last field OnEnter event would be highly appreciated.

Thank you.


Solution

  • Why not simple:

    View.OptionsBehavior.FocusCellOnCycle = True,
    View.OptionBehavior.FocusFirstCellOnNewRecord = True,
    View.OptionBehavior.GotoNextCellOnEnter = True, 
    View.OptionData.Appending = True