vcl-dxganttcontrolviewchart-f18d3133.md
Performs a set of actions in response to a task movement in the chart area.
TdxGanttControlTaskMoveEvent = procedure(Sender: TObject; ATask: TdxGanttControlTask; ANewStart: TDateTime; var AAccept: Boolean) of object;
| Name | Type | Description |
|---|---|---|
| Sender | TObject |
The Chart View that raised the event.
| | ATask | TdxGanttControlTask |
The task that a user drags.
| | ANewStart | TDateTime |
The ATask‘s new start date.
| | AAccept | Boolean |
Specifies if the event handler accepts or declines the task drag-and-drop operation in the chart.
|
You can open the Features Demo and modify its code. Handle the OnTaskMove event and use the following code snippet that prevents users from shifting a task’s start date by more than seven days:
procedure TFeaturesDemoMainForm.GanttControlViewChartTaskMove(Sender: TObject;
ATask: TdxGanttControlTask; ANewStart: TDateTime; var AAccept: Boolean);
begin
AAccept := ANewStart - ATask.Start < 7;
end;
void __fastcall TFeaturesDemoMainForm::GanttControlViewChartTaskMove(TObject *Sender,
TdxGanttControlTask *ATask, TDateTime ANewStart, bool &AAccept)
{
AAccept = (ANewStart - ATask->Start) < static_cast<TDateTime>(7);
}
See Also
TdxGanttControlTaskStartMoveEvent