Tk Source Code

View Ticket
Login
Bounty program for improvements to Tcl and certain Tcl packages.
2020-06-22
08:07 Ticket [1fb7af62] Add support for buttons 4 and 5 to Windows status still Closed with 5 other changes artifact: f34133a6 user: fvogel
00:09 Ticket [1fb7af62]: 5 changes artifact: c7a0b58b user: chrstphrchvz
2020-06-21
22:47 Ticket [cd051b58] bind.n : MouseWheel documentation: event delivered to item under mouse, not to the focus widget status still Open with 3 other changes artifact: 87ec3e86 user: chrstphrchvz
2019-07-22
08:14 Ticket [1fb7af62] Add support for buttons 4 and 5 to Windows status still Open with 4 other changes artifact: 1bb013b0 user: chrstphrchvz
2019-05-18
15:46 Closed ticket [eb29967e]: Add horizontal scrolling support for Windows plus 6 other changes artifact: 03590fb7 user: fvogel
15:45
Fix [eb29967e88]: Add horizontal scrolling support for Windows. Patch from Christopher Chavez. check-in: 93f1a8a2 user: fvogel tags: trunk
15:44
Fix [eb29967e88]: Add horizontal scrolling support for Windows. Patch from Christopher Chavez. check-in: d1b3d2ac user: fvogel tags: core-8-6-branch
2019-04-30
19:47 Closed ticket [ab046f47]: Horizontal scrolling support on Windows plus 7 other changes artifact: 312af1b1 user: fvogel
19:45 Ticket [eb29967e] Add horizontal scrolling support for Windows status still Open with 3 other changes artifact: 6bc6a7d5 user: fvogel
19:15 Ticket [eb29967e]: 3 changes artifact: 4ff8ff27 user: fvogel
2019-04-29
06:22 Ticket [eb29967e]: 4 changes artifact: 444c6862 user: fvogel
06:20
Fix [eb29967e88]: Add horizontal scrolling support for Windows. Patch from Christopher Chavez. Closed-Leaf check-in: b478037a user: fvogel tags: bug-eb29967e88
2019-04-28
21:48 Ticket [eb29967e] Add horizontal scrolling support for Windows status still Open with 4 other changes artifact: e52ef282 user: chrstphrchvz
20:00 Ticket [eb29967e]: 3 changes artifact: 30747ccd user: fvogel
2019-04-05
04:55 Ticket [ab046f47] Horizontal scrolling support on Windows status still Closed with 6 other changes artifact: 8ffa0bd7 user: chrstphrchvz
04:54 Add attachment win-hscroll.diff to ticket [eb29967e] artifact: c7e42c66 user: chrstphrchvz
04:52 New ticket [eb29967e] Add horizontal scrolling support for Windows. artifact: 1065df72 user: chrstphrchvz

Ticket UUID: eb29967e8825c8d80ddf1a575a9cc887ce8bcaab
Title: Add horizontal scrolling support for Windows
Type: Patch Version: 8.6.9
Submitter: chrstphrchvz Created on: 2019-04-05 04:52:34
Subsystem: 01. Bindings Assigned To: fvogel
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2019-05-18 15:46:44
Resolution: Fixed Closed By: fvogel
    Closed on: 2019-05-18 15:46:44
Description:

See [ab046f476f75fc21b7c7] for original RFE. I'm not sure why it was closed as invalid; maybe the suggested implementation was mistaken, but I think the request for functionality was valid, and agree that the implementation is still rather straightforward.

This patch mostly duplicates existing code which handles vertical scrolling from WM_MOUSEWHEEL, and modifies it to instead handle horizontal scrolling from WM_MOUSEHWHEEL. Existing members of tkWinX.c's ThreadSpecificData for handling vertical scrolling have been prefixed with v to distinguish from members added for horizontal scrolling (prefixed with h). I have mirrored the approach used on Aqua (tkMacOSXMouseEvent.c) where horizontal scrolling is somewhat "emulated" where the posted event is equivalent to holding shift while scrolling vertically.

My hope is this can be applied to 8.6.x and not have to wait for 8.7. I am not aware how this might break compatibility with 8.6.9, which silently ignores WM_MOUSEHWHEEL yet supports horizontal scrolling emulation by shift+vertical scrolling.

Tested on core-8-6-branch on Windows 10 1809 x64.

Any suggestions, improvements, etc. are appreciated, as they should certainly be possible (for example, more aggressively combining code duplicated for each case).

User Comments: fvogel added on 2019-05-18 15:46:44:
Merged into core-8-6-branch and trunk.

fvogel added on 2019-04-30 19:45:37:

Perhaps a more demonstrative/complet example:

package require Tk
frame .f
text .f.t -wrap none -yscrollcommand {.f.s set} -xscrollcommand {.sh set}
set s [string repeat "abcdefghijklmnopqrstuvwxyz " 50]
for {set i 1} {$i < 100} {incr i} {
    .f.t insert end [string range $s $i end]\n
}
scrollbar .f.s -command {.f.t yview}
scrollbar .sh -orient horizontal -command {.f.t xview}
pack .f.t .f.s -side left -fill y -expand true
pack .f .sh -fill x -expand true

Scrolling works OK, both horizontally and vertically, and the scrollbars are correctly updated.

I'd appreciate other people testing, thanks!


fvogel added on 2019-04-30 19:15:44:

I have tested the patch using AutoHotKey with the following script file:

^l::
Send {WheelLeft}
return

^m::
Send {WheelRight}
return

and then hitting Ctrl-l (to simulate Mouse Wheel action toward left) or Ctrl-m (to simulate Mouse Wheel action toward right), with the following Tcl/Tk test situation:

package require Tk
pack [text .t -wrap none]
.t insert end [string repeat "abcdefghijklmnopqrstuvwxyz " 50]

I can make the text scroll horizontally in each expected direction. So it looks like this patch is working.

Any other testers perhaps?


fvogel added on 2019-04-29 06:22:21:

Patch committed in branch bug-eb29967e88 so that it can be tested.

(Sorry, I primarily meant: manual tests)


chrstphrchvz added on 2019-04-28 21:48:59:

My question is: how can the feature be tested, i.e. how can we make the OS trigger WM_MOUSEHWHEEL ?

If there was already code for testing WM_MOUSEWHEEL, I might know. From briefly looking, a test might involve using SendMessage() from tkWinTest.c, in turn used from some script via testwinevent. But I really am not familiar with Tk's unit tests, nor have I been compelled to master Tcl syntax for Tk. I understand it is not ideal to add stuff to Tk without automated tests; my motivation for submitting this patch was the ease of implementing the feature itself, not to try sneaking more stuff in without tests; but a test for this is not something I think I would be able to provide anytime soon.

One option I am aware of for manually testing this without horizontal scrolling hardware would be a software utility such as AutoHotKey which can map something like a keypress to scrolling in a direction by a certain amount.


fvogel added on 2019-04-28 20:00:26:

I had a quick look at the patch it looks like I can understand it. My question is: how can the feature be tested, i.e. how can we make the OS trigger WM_MOUSEHWHEEL ?


Attachments: