DBPlanner - Creating an event using "Ins"

Sequence of TDBPlannerMonthView events. I assume the same for TDBPlanner
Ins
OnItemToField (call Dataset.Post)
OnItemCreated
OnItemToField (call Dataset.Post)
I don't like the double call Post

I need:
check whether the action can run at all !!!
enter the necessary data. Now I'm trying it in OnItemCreated. Works.

The OnCreateKey event was fired before. Not now. Probably because:
DBPlanner.AutoIncKey = True
DBPlanner.KeyField = PrimaryKeyField

I don't know when and how to set the MinTime and MaxTime dates to 7/14/2020.
I have no such date anywhere. Not even in DB.

I didn't find how to do it anywhere. :frowning_face:
I want to make the most of what you offer.

I solved it later. I do not like it.

AutoIncKey = False;

procedure TfrmPlannerRole.dbpmwMonthCreateKey(Sender: TObject; APlannerItem: TPlannerItem; var Key: string);
begin
  if (dtpFromMonth.Date > dtpToMonth.date) then
  begin
    ShowMessage('The From date must be before the date To');
    APlannerItem.Free;
  end
  else
  begin
    APlannerItem.Text.Text := 'Created programmatically';
    APlannerItem.Tag := -1;
    APlannerItem.Shape := TPlannerShape(0);
    APlannerItem.CaptionType := TCaptionType(1);
    APlannerItem.DBKey := '-1';
    APlannerItem.Update;
    fdtblPlanner.Insert;
  end;
end;

procedure TfrmPlannerRole.dbpmwMonthItemToFields(Sender: TObject; Fields: TFields; Item: TPlannerItem);
begin
  if (dtpFromMonth.Date > dtpToMonth.date) then
    Exit;

  if Item.DBKey = '' then
  begin
    Item.DBKey := IntToStr(NewPrimaryKey);
    Fields.FieldByName('SUBJECT').AsString := 'Unspecified subject';
  end;

  Fields.FieldByName('IDPLANNERS').AsInteger := StrToInt(Item.DBKey);

Tested with demo 23 and I cannot reproduce that OnItemToFields is triggered more than once when inserting a new item.
Tested also with TDBPlanner, and this double triggering of OnItemToFields cannot be reproduced.