質問

ユーザーが現在のレコードの最後のフィールドにEnterキーを押すたびに、新しいレコードを追加するためにTCXGridを作成するのに苦労していますが、これを達成するのに役立つプロパティは見つかりませんでした。

次のコードで、グリッドビュー(tcxgriddbtableview)のonkeydownイベントを設定しようとしました

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

ただし、コードは何らかの理由で実行されません...

Last Field Onenterイベントにレコードを追加する方法に関するアイデアは非常に高く評価されます。

ありがとうございました。

役に立ちましたか?

解決

なぜシンプルではないのか:

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

他のヒント

これを解決する方法は、このタイプの機能を処理するために、グリッドビューのoneditkeydown/up/pressを設定することです。

procedure XXX.PaymentViewEditKeyUp(Sender: TcxCustomGridTableView;
  AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit; var Key: Word;
  Shift: TShiftState);
begin
  if Key = VK_RETURN then
    if PaymentViewBetragNetto.Focused then begin
      ADataModule.ATable.Append;
      PaymentViewAccount.FocusWithSelection;
    end; // if PaymentViewBetragNetto.Focused then begin
end;
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top