| Ticket UUID: | 89e37b05193a2bbd66384a1d7d42166b636f18f3 | |||
| Title: | Windows : menu scroll using two fingers on trackpad | |||
| Type: | RFE | Version: | ||
| Submitter: | nab | Created on: | 2020-08-28 18:12:56 | |
| Subsystem: | 68. Win Window Operations | Assigned To: | nobody | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Open | Last Modified: | 2026-10-28 17:29:45 | |
| Resolution: | None | Closed By: | nobody | |
| Closed on: | ||||
| Description: |
Hi, when a ttk::menutton pop-up a menu, if this menu contains 1000 items and only 50 are print on the screen, on macOS I can use the trackpad and two fingers to scroll menu and access top and bottoms values. it would be nice if it could behave the same on windows. For now, using winxp theme, two fingers scrolling does nothing. Is that something that can be improved? best regards, Nicolas | |||
| User Comments: |
nab added on 2026-10-28 17:29:45:
Measured on Windows 11 (build 26300): native popup menus, and so Tk menus, do not scroll with the mouse wheel or a touchpad. Windows discards the wheel while a menu is open: the application never receives it. Only the scroll arrows work, by click or while the button is held. Branch nab-win-menu-wheel (9287185a31) receives the wheel as raw input while a menu is open, and replays each line as a click on the scroll arrow of the menu under the pointer. Popup menus, cascades and menubar menus then scroll with the mouse wheel and the touchpad, as on X11 and macOS. Menus that fit on the screen are not affected. Tested at 200 % and 100 % scaling: the test suite gives the same results as trunk. Not tested on Windows 10. serhiy.storchaka added on 2026-10-03 20:39:26: On X11, menus taller than the screen can now be scrolled, including with the mouse wheel ([4e7fbe8b4a]). On Windows, native Win32 popup menus do not scroll with the mouse wheel either. I am not sure that it is worth implementing this in Tk: it would make Tk applications behave differently from other Windows applications. nab added on 2020-09-28 19:50:32: thanks Brad for your time involved in this RFE ++ bll added on 2020-09-28 19:32:14: Looking at the code, Tk uses the MS CreatePopupMenu() function, but draws its own stuff inside of it. So what you're asking isn't going to work unless someone rewrites it to use the native menu functions. Your request on comp.lang.tcl is probably the best way. Unfortunately, there doesn't seem to be a Marc Culler for Windows around. I'm not a Windows developer, no way I can help, sorry. nab added on 2020-09-28 18:51:53: Hi Brad, sorry it was kid/diner time... there's no need for a long menu, just put the menubutton at the bottom of your screen with -direction below. the menu should appear with an arrow at the bottom of the menu and this is a situation where I would like to be able to use two fingers to scroll it ++ bll added on 2020-09-28 17:27:04: Can you supply some sample code that produces a long menu. I had no luck finding a native application with a long menu (I didn't spend too much time on that). bll added on 2020-09-28 16:25:45: Have you located any long menus within a native window application that can be used to determine the native behavior? I have booted windows 10, and I'm searching. bll added on 2020-09-28 16:10:50: Can you try the TIP 474 branch? Though I suspect it will not help. nab added on 2020-09-28 05:10:11: Hi, Is something can be done about that? (before 6.6.11 release?) ++ Nicolas bll added on 2020-08-29 13:31:06: Well, not so simple. I tried adding WS_VSCROLL, but no scrollbar showed up. The code doesn't really use the native windows menu functions, there's still a lot of lets-draw-our-own-widgets going on. I'm not a windows programmer, the code uses an old windows API. I don't know that I can do anything. nab added on 2020-08-29 12:09:29: Hi Brad, thank you fro following this RFE... here's another example: I've a button at the bottom of my app that display a menu and the user can have moved the toplevel to the bottom of the screen. In that case the menu fit well according to the bottom of the screen, a black arrow appears to let user choose bottom options of the menu. So in that case, even if the menu is not that long and does not need to be breaked, two fingers scrolling would be nice ++ bll added on 2020-08-29 12:02:43: Another option would be to subdivide the menu into cascades
(assuming no fix):
Options 1-100:
Options 1-10:
...
Options 91-100:
Options 101-200:
Options 101-111:
bll added on 2020-08-29 11:52:35: I am looking at the windows code.
And at:
https://docs.microsoft.com/en-us/windows/win32/controls/create-scroll-bars
I think that it should be possible to put in code that would say
if menu has more than 15 items,
add the WS_VSCROLL flag to enable the vertical scrollbar.
It may not be quite that simple though.
bll added on 2020-08-29 11:46:17: Linux: No scrolling whatsoever, I have to tear off the menu and Alt-move the
entire window up in order to select from the bottom.
It appears that really long menus on Linux are a really bad idea.
MacOS: Other than having black on black (I have dark mode set), it works
great. Mouse wheel works, arrows are automatic.
Windows 8.1: Has arrows which have to be clicked on, no repeat, nothing
automatic. No mouse wheel.
It appears that the windows menu is native.
For Linux, the menu should be reformed into multiple columns (if it's going
to be that long).
nab added on 2020-08-29 06:51:09: Hi Brad,
I meant that canvas and tablelists do have scrollbars, not menus...
using this script:
package require Tk
package require Ttk
proc doLongMenu {w} {
if {[winfo exists $w]} {destroy $w}
set myMenu [menu $w]
$myMenu configure -bg white -fg black
for {set x 0} {$x < 180} {incr x 3} {
$myMenu add command -label "menu $x" -command [list puts $x]
}
}
ttk::button .b -text "push"
doLongMenu .mMenu
bind .b <ButtonPress-1> [list tk_popup .mMenu %X %Y]
grid .b -sticky nsew
on macOS, the menu is just long enough to not be entirely displayed on the screen.
when the menu is posted, I can use two fingers on the trackpad to scroll down the menu.
I was wondering if this behaviour could be the same on windows?
another good thing of menu on macOS over windows is that when the menu is not entirely drawn on screen, there's two arrows that do appear on bottom and top of the menu.
if I put the mouse pointer over one of those arrow, the menu is scrolling (without the need for clicking). so cool...
for now on windows I need to click many many times to reach the bottom of the menu.
hope it's clear and doable
++
nicolas
bll added on 2020-08-28 21:44:46: I wasn't aware that there were any menus with scrollbars. If there is a mousewheel binding missing, this is a bug, not an rfe. Do you have some sample code? nab added on 2020-08-28 19:45:19: maybe. it would be nice to have the same behaviour on windows that on macOS... ++ bll added on 2020-08-28 19:27:23: Maybe there's a mousewheel binding missing for the menu. nab added on 2020-08-28 19:12:41: @bll, I can scroll in canvas or tableLists using two fingers. not in menu... but indeed they have a scrollbar attached. it's just that I find very convenient to use two fingers to scroll menus (with/out a scrollbar) @Christopher 1000 items is maybe too much... bll added on 2020-08-28 19:05:24: My flexmenu package has menus with a real scrollbar. bll added on 2020-08-28 19:01:59: That's a function of the mousepad, not Tk. Check on windows and see what mousepad settings are available. Edge scrolling is common. chrstphrchvz added on 2020-08-28 19:01:58: Following this ticket out of curiosity. Without checking, I would think any such binding is OS-provided outside of X11. But I think having that many items in a popup menu to begin with is not ideal; the Apple HIG says to "be mindful of menu length". | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki