Back to Devexpress

TdxGanttControlTaskMoveEvent Type

vcl-dxganttcontrolviewchart-f18d3133.md

latest2.1 KB
Original Source

TdxGanttControlTaskMoveEvent Type

Performs a set of actions in response to a task movement in the chart area.

Declaration

delphi
TdxGanttControlTaskMoveEvent = procedure(Sender: TObject; ATask: TdxGanttControlTask; ANewStart: TDateTime; var AAccept: Boolean) of object;

Parameters

NameTypeDescription
SenderTObject

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.

|

Remarks

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:

delphi
procedure TFeaturesDemoMainForm.GanttControlViewChartTaskMove(Sender: TObject;
  ATask: TdxGanttControlTask; ANewStart: TDateTime; var AAccept: Boolean);
begin
  AAccept := ANewStart - ATask.Start < 7;
end;
cpp
void __fastcall TFeaturesDemoMainForm::GanttControlViewChartTaskMove(TObject *Sender,
          TdxGanttControlTask *ATask, TDateTime ANewStart, bool &AAccept)
{
  AAccept = (ANewStart - ATask->Start) < static_cast<TDateTime>(7);
}

See Also

TdxGanttControlTaskStartMoveEvent

TdxGanttControlTaskEndMoveEvent

dxGanttControlViewChart Unit