Ticket A775
Visible to All Users

How do I determine under which tab of a PageControl the mouse pointer is above

created 21 years ago

Description:
I use the TcxPageControl and I want to move pages using drag&drop. When I start the dragging, I save the PageIndex property value of the dragged page with the help of the OnStartDrag event using the ActivePageIndex property. But how can I determine the PageIndex of the page I want to “replace” if I use the OnEndDrag event?

Answer:
Basically, you may use the PageControl's IndexOfTabAt method to determine the TabSheet the mouse pointer is over. Here is some sample code:

Delphi
procedure TForm1.cxPageControl1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); var Index: Integer; begin with TcxPageControl(Sender) do begin Index := IndexOfTabAt(X, Y); // your code here end; end;

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.