Skip to main content

TdxCustomSpreadSheet.OnPageControlTabDragAndDrop Event

Enables you to render certain positions invalid for worksheet tab drag-and-drop operations within the caption bar.

Declaration

property OnPageControlTabDragAndDrop: TdxSpreadSheetPageControlTabDragAndDropEvent read; write;

Remarks

This event occurs every time a user moves the dragged worksheet tab to a new valid drop position on the caption bar. You can assign False to the AAccepted parameters within an OnPageControlTabDragAndDrop event handler to force the control to treat the current worksheet tab position as an invalid drop target. An attempt to drop the tab cancels the drag-and-drop operation. For instance, you can forbid a user from swapping the first and last worksheet tabs via drag-and-drop:

procedure TMyForm.dxSpreadSheet1PageControlTabDragAndDrop(ASpreadSheet: TdxCustomSpreadSheet; AIndex, ANewIndex: Integer; var AAccepted: Boolean);
begin
  if(((AIndex = 0) and (ANewIndex = ASpreadSheet.VisibleSheetCount - 1)) or ((AIndex = ASpreadSheet.VisibleSheetCount - 1) and (ANewIndex = 0))) then
  AAccepted := False;
end;

Refer to the TdxSpreadSheetPageControlTabDragAndDropEvent procedural type description for detailed information on all parameters accessible within an OnPageControlTabDragAndDrop event handler.

Note

The OnPageControlTabDragAndDrop event does not occur when a user moves the dragged worksheet tab back to its original position or outside the caption bar.

See Also