wxScrolled<> autoscroll zone

59 views
Skip to first unread message

wsu

unread,
Nov 10, 2025, 9:31:32 PMNov 10
to wx-dev
The wxScrolled<> template implements autoscrolling, but only when the mouse cursor is dragged outside the wxScrolled<> window.  I would prefer that autoscrolling occur when the mouse cursor is near the edge of the window, but still in it.  Is there either a technical or user experience reason for only scrolling when the mouse cursor is outside the window?

Vadim Zeitlin

unread,
Nov 11, 2025, 11:01:18 AMNov 11
to wx-...@googlegroups.com
On Mon, 10 Nov 2025 18:31:32 -0800 (PST) 'wsu' via wx-dev wrote:

w> The wxScrolled<> template implements autoscrolling, but only when the mouse
w> cursor is dragged outside the wxScrolled<> window. I would prefer that
w> autoscrolling occur when the mouse cursor is near the edge of the window,
w> but still in it. Is there either a technical or user experience reason for
w> only scrolling when the mouse cursor is outside the window?

I'm not sure how well would this work, as the mouse would still be over
the scrollbar then. Do you know of any applications in common use that
behave like this?

Regards,
VZ

wsu

unread,
Nov 11, 2025, 10:38:48 PMNov 11
to wx-dev
Maybe I'm not communicating what I mean well, because, at least in Windows 10, Windows Explorer and LibreOffice Calc both behave the way I mean.  They scroll before the mouse gets into the scrollbar, and, of course, there aren't scrollbars on the left and top sides of the window.

Vadim Zeitlin

unread,
Nov 12, 2025, 3:56:35 PMNov 12
to wx-...@googlegroups.com
On Tue, 11 Nov 2025 19:38:48 -0800 (PST) 'wsu' via wx-dev wrote:

w> Maybe I'm not communicating what I mean well, because, at least in Windows
w> 10, Windows Explorer and LibreOffice Calc both behave the way I mean. They
w> scroll before the mouse gets into the scrollbar, and, of course, there
w> aren't scrollbars on the left and top sides of the window.

Sorry, maybe I misunderstood what you meant, but I just don't see this
behaviour in e.g. Explorer, how exactly can I reproduce it? What I do is to
open a directory with many files (e.g. wxWidgets include/wx one) in
"Details" view. Then if I start drag selecting files, the window doesn't
scroll as long as the mouse remains inside it, but as soon as it leaves it,
it starts auto-scrolling. Can you please explain how is this different from
what wx does?

Thanks,
VZ

wsu

unread,
Nov 12, 2025, 9:06:10 PMNov 12
to wx-dev
On Wednesday, November 12, 2025 at 3:56:35 PM UTC-5 Vadim Zeitlin wrote:
Sorry, maybe I misunderstood what you meant, but I just don't see this
behaviour in e.g. Explorer, how exactly can I reproduce it? What I do is to
open a directory with many files (e.g. wxWidgets include/wx one) in
"Details" view. Then if I start drag selecting files, the window doesn't
scroll as long as the mouse remains inside it, but as soon as it leaves it,
it starts auto-scrolling. Can you please explain how is this different from
what wx does?

I am also using the Windows Explorer Details view.  Try dragging a file rather than drag-selecting.  I think drag-select also scrolls while within the window, but I admit the scrolling happens when the cursor is VERY close to the edge of the window, whereas dragging a file seems to start scrolling a significant distance before the cursor reaches the window edge.  It does seem weird to me that the scroll zone differs for the two operations.  (I verified these observations in wxWidgets/include/wx.)

Vadim Zeitlin

unread,
Nov 13, 2025, 4:50:44 PMNov 13
to wx-...@googlegroups.com
On Wed, 12 Nov 2025 18:06:10 -0800 (PST) 'wsu' via wx-dev wrote:

w> I am also using the Windows Explorer Details view. Try dragging a file
w> rather than drag-selecting. I think drag-select also scrolls while within
w> the window, but I admit the scrolling happens when the cursor is VERY close
w> to the edge of the window, whereas dragging a file seems to start scrolling
w> a significant distance before the cursor reaches the window edge. It does
w> seem weird to me that the scroll zone differs for the two operations. (I
w> verified these observations in wxWidgets/include/wx.)

Yes, this is indeed very strange, but I do see the auto scroll starting
while the mouse is still in the window when dragging the file. Somehow I
had never noticed this before, sorry (but then I don't use mouse a lot).

At the code level, we should be able to extend the current code to work
like this by starting the auto scroll timer on mouse move too and not just
on leaving the window. However it would need to be configurable, e.g. by
adding some function to set the distance from the border of the window when
auto scrolling starts.

Or maybe we shouldn't do it in wxScrolledWindow itself but just extract
this into a reusable wxAutoScroller class that could be reused by the
application in whichever way it wants?

Regards,
VZ

wsu

unread,
Nov 13, 2025, 10:30:10 PMNov 13
to wx-dev
On Thursday, November 13, 2025 at 4:50:44 PM UTC-5 Vadim Zeitlin wrote:
At the code level, we should be able to extend the current code to work
like this by starting the auto scroll timer on mouse move too and not just
on leaving the window. However it would need to be configurable, e.g. by
adding some function to set the distance from the border of the window when
auto scrolling starts.
 
Since you're not aware of any obvious impediment, I will investigate further...
Reply all
Reply to author
Forward
0 new messages