Frequently Asked Component Specific Questions
Options |
|
Display all FAQ items |
Displaying items 1 to 1 of 1, page 1 of 1
<< previous next >>

TMS FMX UI PackTTMSFMXPlanner: How to use a custom editor for inserting and updating items
Using a custom editor is demonstrated in the Editing demo. You need to drop a custom content panel / control on the form and pass it through the OnGetCustomContentPanel event. The OnItemToCustomContentPanel and OnCustomContentPanelToItem is used to transfer data between item and panel.
procedure TForm1.TMSFMXPlanner1CustomContentPanelToItem(Sender: TObject;
AContentPanel: TControl; AItem: TTMSFMXPlannerItem); var
c: TCheckBox;
b: TColorComboBox;
begin
c := FindChild(AContentPanel, ''chkOperation'') as TCheckBox;
b := FindChild(AContentPanel, ''cboCategory'') as TColorComboBox;
AItem.BeginUpdate;
AItem.Color := b.Color;
AItem.DataBoolean := c.IsChecked;
AItem.EndUpdate;
end;
procedure TForm1.TMSFMXPlanner1GetCustomContentPanel(Sender: TObject;
AItem: TTMSFMXPlannerItem; var AContentPanel: TControl); begin
if Assigned(AItem) and (AItem.Resource = 1) then
AContentPanel := Panel1;
end;
procedure TForm1.TMSFMXPlanner1ItemToCustomContentPanel(Sender: TObject;
AItem: TTMSFMXPlannerItem; AContentPanel: TControl); var
l: TLabel;
c: TCheckBox;
img: TImage;
b: TColorComboBox;
begin
l := FindChild(AContentPanel, ''lblPatient'') as TLabel;
l.Text := ''Patiƫnt: '' + AItem.Title;
c := FindChild(AContentPanel, ''chkOperation'') as TCheckBox;
c.IsChecked := AItem.DataBoolean;
img := FindChild(AContentPanel, ''imgPatient'') as TImage;
img.Bitmap.Assign(TMSFMXBitmapContainer1.FindBitmap(AItem.DataString));
b := FindChild(AContentPanel, ''cboCategory'') as TColorComboBox;
b.Color := AItem.Color;
end;