Back to Devexpress

TdxGanttControlTaskCreateEvent Type

vcl-dxganttcontrolviewchart-5032332f.md

latest2.4 KB
Original Source

TdxGanttControlTaskCreateEvent Type

Performs a set of actions during a task create operation (with the mouse) in the chart.

Declaration

delphi
TdxGanttControlTaskCreateEvent = procedure(Sender: TObject; AID: Integer; AStart: TDateTime; AFinish: TDateTime; var AAccept: Boolean) of object;

Parameters

NameTypeDescription
SenderTObject

The Chart View that raised the event.

| | AID | Integer |

The task’s unique identifier.

| | AStart | TDateTime |

The task’s start date.

| | AFinish | TDateTime |

The task’s finish date.

| | AAccept | Boolean |

Specifies if the event handler accepts or declines a task create operation in response to a mouse drag-and-drop action.

|

Remarks

You can open the Features Demo and modify its code. Handle the OnTaskCreate event and use the following code snippet to restrict users from creating tasks that last more than seven days:

delphi
procedure TFeaturesDemoMainForm.GanttControlViewChartTaskCreate(Sender: TObject;
  AID: Integer; AStart, AFinish: TDateTime; var AAccept: Boolean);
begin
  AAccept := AFinish - AStart < 7;
end;
cpp
void __fastcall TFeaturesDemoMainForm::GanttControlViewChartTaskCreate(TObject *Sender,
          int AID, TDateTime AStart, TDateTime AFinish, bool &AAccept)
{
  AAccept = (AFinish - AStart) < static_cast<TDateTime>(7);
}

See Also

TdxGanttControlTaskStartCreateEvent

TdxGanttControlTaskEndCreateEvent

dxGanttControlViewChart Unit