Skip to main content

TcxCustomHeader.OnSectionDrag Event

Occurs when a user drags a section.

Declaration

property OnSectionDrag: TcxSectionDragEvent read; write;

Remarks

The OnSectionDrag event occurs when the user drags a section of the cxHeader control.

Parameter Meaning
Sender A TcxHeader object that fired the event.
FromSection A header control section involved in the drag-and-drop operation.
ToSection A header control section representing the destination point of the drag-and-drop operation.
AllowDrag True, if dragging is allowed; False, if dragging is disabled. This parameter can be used to restrict drag-and-drop operations (see the example below).

If you want to react after the drag-and-drop operation was successfully completed, handle the OnSectionEndDrag event.

The following code shows an OnSectionDrag event handler preventing drag-and-drop when the destination is the header control section with an ID property value of 3:

procedure TForm1.cxHeader1SectionDrag(Sender: TObject; FromSection,
  ToSection: TcxHeaderSection; var AllowDrag: Boolean);
begin
  AllowDrag := ToSection.ID <> 3;
end;
See Also