To save an item in the database from a custom editor, you need to use the following code:
var
st, et: TDateTime;
it: TTMSFNCPlannerItem;
begin
st := Now;
et := Now + 1;
it := TMSFNCPlanner1.AddItem(st, et);
it.DataString := 'Data1;Data2;Data3';
TMSFNCPlannerDatabaseAdapter1.InsertItem(it);
As you have additional data in your dialog that needs to be saved as well you need to have an event attached to the OnItemToFields and OnFieldsToItem, and store the data inside the DataString property. You could also write a custom class that saves the data to the DataObject instead if you are using data other than strings or you wish to not have to convert to values while saving.
procedure TForm79.TMSFNCPlannerDatabaseAdapter1FieldsToItem(Sender: TObject;
AFields: TFields; AItem: TTMSFNCPlannerItem);
var
s: string;
begin
//Data1
s := AFields.FieldByName('Data1').AsString;
//Data2
s := s + ';' +AFields.FieldByName('Data2').AsString;
//Data3
s := s + ';' +AFields.FieldByName('Data3').AsString;
AItem.DataString := s;
end;
procedure TForm79.TMSFNCPlannerDatabaseAdapter1ItemToFields(Sender: TObject;
AItem: TTMSFNCPlannerItem; AFields: TFields);
var
sl: TStringList;
begin
sl := TStringList.Create;
try
TTMSFNCUtils.Split(';', AItem.DataString, sl);
//Data1
AFields.FieldByName('Data1').AsString := sl[0];
//Data2
AFields.FieldByName('Data2').AsString := sl[1];
//Data3
AFields.FieldByName('Data3').AsString := sl[2];
finally
sl.Free;
end;
end;