wxScrolled<>: documentation and sample improvements (PR #26304)

12 views
Skip to first unread message

Bill Su

unread,
Mar 17, 2026, 12:45:30 AM (yesterday) Mar 17
to wx-...@googlegroups.com, Subscribed

You can view, comment on, or merge this pull request online at:

  https://github.com/wxWidgets/wxWidgets/pull/26304

Commit Summary

  • 708eeb7 wxScrolled<>: document how to drag between windows
  • 732812d dnd: improve autoscroll example

File Changes

(3 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26304@github.com>

Bill Su

unread,
Mar 17, 2026, 12:59:04 AM (yesterday) Mar 17
to wx-...@googlegroups.com, Push

@wsu-cb pushed 1 commit.

  • 1d91d71 dnd: improve autoscroll example


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26304/before/732812d6523d13facab710182439f5a973d5be59/after/1d91d71a8ce433857bfda68125e68232a4ffdcd9@github.com>

VZ

unread,
Mar 17, 2026, 9:21:50 AM (17 hours ago) Mar 17
to wx-...@googlegroups.com, Subscribed

@vadz commented on this pull request.

Thanks, changes to the documentation are good, but I'm less sure about the changes to the sample (using unique_ptr is good, of course, but moving the handlers to another class is less obviously so).


In samples/dnd/dnd.cpp:

>  {
 public:
     DnDShapeFrame(wxFrame *parent);
-    ~DnDShapeFrame();
+
+protected:
+    bool TryBefore(wxEvent& event) override;

I think overriding this function is sufficiently rare to merit a comment explaining why do we do this.


In interface/wx/scrolwin.h:

> @@ -541,6 +553,23 @@ class wxScrolled : public T
     */
     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
⬇️ Suggested change
-        @since 3.3.0
+        @since 3.3.3

In interface/wx/scrolwin.h:

> @@ -541,6 +553,23 @@ class wxScrolled : public T
     */
     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
⬇️ Suggested change
-        @since 3.3.0
+        @since 3.3.3

In samples/dnd/dnd.cpp:

> @@ -867,20 +866,20 @@ wxEND_EVENT_TABLE()
 
 #if wxUSE_DRAG_AND_DROP
 
-wxBEGIN_EVENT_TABLE(DnDShapeFrame, wxFrame)
-    EVT_MENU(Menu_Shape_New,    DnDShapeFrame::OnNewShape)
-    EVT_MENU(Menu_Shape_Edit,   DnDShapeFrame::OnEditShape)
-    EVT_MENU(Menu_Shape_Clear,  DnDShapeFrame::OnClearShape)
+wxBEGIN_EVENT_TABLE(DnDShapeCanvas, wxScrolledCanvas)

Not sure why did all these functions have to be moved to another class. I don't see anything wrong with it, per se, but this results in a lot of changes and I don't understand why do we need them?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26304/review/3960688887@github.com>

Bill Su

unread,
12:05 AM (2 hours ago) 12:05 AM
to wx-...@googlegroups.com, Subscribed

@wsu-cb commented on this pull request.


In samples/dnd/dnd.cpp:

> @@ -867,20 +866,20 @@ wxEND_EVENT_TABLE()
 
 #if wxUSE_DRAG_AND_DROP
 
-wxBEGIN_EVENT_TABLE(DnDShapeFrame, wxFrame)
-    EVT_MENU(Menu_Shape_New,    DnDShapeFrame::OnNewShape)
-    EVT_MENU(Menu_Shape_Edit,   DnDShapeFrame::OnEditShape)
-    EVT_MENU(Menu_Shape_Clear,  DnDShapeFrame::OnClearShape)
+wxBEGIN_EVENT_TABLE(DnDShapeCanvas, wxScrolledCanvas)

The problem I am addressing is that, if I don't create a DnDShapeCanvas window that performs the scrolling, then the scrolling is part of the DnDShapeFrame, and that causes the status bar to move when the frame scrolls. At that point, I think there are actually fewer changes by having the shape operations implemented by DnDShapeCanvas rather than DnDShapeFrame.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26304/review/3964881295@github.com>

Bill Su

unread,
12:13 AM (2 hours ago) 12:13 AM
to wx-...@googlegroups.com, Push

@wsu-cb pushed 2 commits.

  • 2e6689f wxScrolled<>: fix wrong @since versions
  • b51b388 dnd: comment purpose of DnDShapeFrame::TryBefore()


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26304/before/1d91d71a8ce433857bfda68125e68232a4ffdcd9/after/b51b388f9a5d08ec9f744dd855e42ef528eec346@github.com>

Bill Su

unread,
12:16 AM (2 hours ago) 12:16 AM
to wx-...@googlegroups.com, Subscribed

@wsu-cb commented on this pull request.


In samples/dnd/dnd.cpp:

>  {
 public:
     DnDShapeFrame(wxFrame *parent);
-    ~DnDShapeFrame();
+
+protected:
+    bool TryBefore(wxEvent& event) override;

Commented in b51b388


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26304/review/3964924975@github.com>

Bill Su

unread,
12:17 AM (2 hours ago) 12:17 AM
to wx-...@googlegroups.com, Subscribed

@wsu-cb commented on this pull request.


In interface/wx/scrolwin.h:

> @@ -541,6 +553,23 @@ class wxScrolled : public T
     */
     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

I apologize for the careless mistake.

Fixed in 2e6689f


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26304/review/3964928954@github.com>

Bill Su

unread,
12:18 AM (2 hours ago) 12:18 AM
to wx-...@googlegroups.com, Subscribed

@wsu-cb commented on this pull request.


In interface/wx/scrolwin.h:

> @@ -541,6 +553,23 @@ class wxScrolled : public T
     */
     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

At least I was consistent.

Fixed in 2e6689f


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26304/review/3964930533@github.com>

Reply all
Reply to author
Forward
0 new messages