Getting started with TMS FNC Gantt Chart Database Adapter
TTMSFNCGanttChartDatabaseAdapter turns a Gantt chart into a live view of a
dataset: it loads task records from a TDataSet and writes interactive edits
back. This page wires the adapter to a chart and a data source and activates the
binding; the Guides cover field mapping, reloading, and custom
mapping events.
Prerequisites
- TMS FNC Core installed and its runtime package referenced.
- TMS FNC Gantt Chart installed and its runtime package referenced.
- A
TDataSet-compatible component (e.g.TFDQuery,TClientDataSet) exposed through aTDataSource.
Add the components
- Drop a
TTMSFNCGanttChartonto the form. - Drop a
TTMSFNCGanttChartDatabaseAdapteronto the form. - Drop a
TDataSourceand point it at your dataset.
Wire the adapter
Attach the adapter to the chart's Adapter property, point Item.DataSource at
the TDataSource, map the field names, and activate:
procedure TForm1.ConnectAdapter;
begin
// The chart consumes tasks through its Adapter; the adapter reads a dataset.
GanttChart1.Adapter := GanttChartDatabaseAdapter1;
// The data source is a TDataSource, not the dataset directly.
GanttChartDatabaseAdapter1.Item.DataSource := DataSource1;
GanttChartDatabaseAdapter1.Item.AutoIncrementDBKey := False;
// Map dataset field names to task properties.
GanttChartDatabaseAdapter1.Item.DBKey := 'Id';
GanttChartDatabaseAdapter1.Item.WBS := 'Wbs';
GanttChartDatabaseAdapter1.Item.TaskName := 'Name';
GanttChartDatabaseAdapter1.Item.Description := 'Description';
GanttChartDatabaseAdapter1.Item.PlannedStart := 'PlannedStart';
GanttChartDatabaseAdapter1.Item.PlannedEnd := 'PlannedEnd';
GanttChartDatabaseAdapter1.Item.Duration := 'Duration';
GanttChartDatabaseAdapter1.Item.Dependencies := 'Dependencies';
GanttChartDatabaseAdapter1.Item.Progress := 'Progress';
GanttChartDatabaseAdapter1.Item.StateName := 'Statename';
// Activate the binding; the chart's tasks now reflect the dataset.
GanttChartDatabaseAdapter1.Active := True;
end;
procedure TForm1.DisconnectAdapter;
begin
GanttChartDatabaseAdapter1.Active := False;
end;
Note
The chart drives its tasks through GanttChart1.Adapter. Field mappings live
on Adapter.Item, and Item.DataSource is a TDataSource. There is no
adapter.GanttChart or adapter.DataSet property.
Next steps
- Guides — full field-mapping table,
LoadTasks/SaveTasks, and custom mapping events. - API reference — full class reference.