From 708eeb7786a58268a88eb8108824616e922fb899 Mon Sep 17 00:00:00 2001 From: Bill Su Date: Mon, 16 Mar 2026 00:20:11 -0400 Subject: [PATCH] wxScrolled<>: document how to drag between windows --- include/wx/scrolwin.h | 2 +- interface/wx/scrolwin.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/include/wx/scrolwin.h b/include/wx/scrolwin.h index 3236e9e037..2783930247 100644 --- a/include/wx/scrolwin.h +++ b/include/wx/scrolwin.h @@ -168,7 +168,7 @@ public: wxEventType& evtHorzScroll, wxEventType& evtVertScroll) const; - // wxWidgets <= 3.3.1 mostly restricted autoscroll to the + // wxWidgets <= 3.3.2 mostly restricted autoscroll to the // window holding the mouse capture. However, when dragging // objects between windows, the destination window should be // the window that is scrolling (to allow positioning the diff --git a/interface/wx/scrolwin.h b/interface/wx/scrolwin.h index 5f2d9901b2..f913bd17bd 100644 --- a/interface/wx/scrolwin.h +++ b/interface/wx/scrolwin.h @@ -116,6 +116,18 @@ enum wxScrollbarVisibility To disable autoscrolling completely, call DisableAutoScrollOutside() without calling EnableAutoScrollInside(). + wxWidgets <= 3.3.2 mostly restricted autoscroll to the window holding the + mouse capture. However, when dragging objects between windows, the + destination window, which may or may not be the capturing window, should be + the window that is scrolling (to allow positioning the dragged object). + To support this, as of wxWidgets 3.3.3, a window can call + EnableAutoscrollWithoutCapture() when processing a drag-enter, and + DisableAutoscrollWithoutCapture() when processing a drag-exit or drag-drop. + (If a window supports dragging content to another window, it should use + EnableAutoScrollInside() and DisableAutoScrollOutside() to avoid + autoscrolling while a destination window is also autoscrolling.) See the + shape frame portion of the @sample{dnd} for an example of dragging + from one window to another. @beginStyleTable @style{wxHSCROLL} @@ -541,6 +553,23 @@ public: */ void Scroll(const wxPoint& pt); + /** + Set this window to autoscroll even if it has not captured the mouse + (assuming the mouse cursor is in its autoscroll zone). This is + intended to be called on drag-enter to support drag and drop between + windows. + + @since 3.3.0 + */ + void EnableAutoscrollWithoutCapture(); + /** + Undo EnableAutoscrollWithoutCapture(). This is intended to be called on + drag-exit and drag-drop when supporting drag and drop between windows. + + @since 3.3.0 + */ + void DisableAutoscrollWithoutCapture(); + /** Set the horizontal and vertical scrolling increment only. See the pixelsPerUnit parameter in SetScrollbars().