Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TdxCustomSpreadSheet.OnPageControlTabDragAndDrop Event

In This Article

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

#Declaration

Delphi
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