Tk Source Code

Check-in [ec79505ee6]
Login
Bounty program for improvements to Tcl and certain Tcl packages.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add scrollwheel bindings to ttk::scrollbar by redirection of the bindings to tk:scrollbar. Ticket [2b8fa6fd]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-6-branch
Files: files | file ages | folders
SHA3-256: ec79505ee6a51f6fd0ffe6c1220c116cf85e43284707f6e1db415a818d9267ee
User & Date: oehhar 2020-01-11 17:10:44
References
2020-01-11
17:26 Closed ticket [2b8fa6fd91]: ttk::scrollbar is missing MouseWheel bindings plus 7 other changes artifact: 42289e4baf user: oehhar
Context
2020-01-18
11:27
Fix [1771594fff]: icursor @x,y fails for non-default scrollregions. Add non regression test canvText-14.7 check-in: 1d76e4e295 user: fvogel tags: core-8-6-branch
2020-01-17
22:15
A better fix for [bf93d098d7]: Aqua menus can be unresponsive at startup Closed-Leaf check-in: 5f8086ffd4 user: marc_culler tags: bug-bf93d098d7-redux
2020-01-11
17:23
Add scrollwheel bindings to ttk::scrollbar by redirection of the bindings to tk::scrollbar. Ticket [2b8fa6fd] check-in: 5cc8fffe49 user: oehhar tags: trunk
17:10
Add scrollwheel bindings to ttk::scrollbar by redirection of the bindings to tk:scrollbar. Ticket [2b8fa6fd] check-in: ec79505ee6 user: oehhar tags: core-8-6-branch
2020-01-06
12:13
Merge 8.5 check-in: 3cfdca758c user: jan.nijtmans tags: core-8-6-branch
2019-12-19
13:08
Redirect scroll wheel related bindings from ttk::scrollbar to scrollbar as proposed by Csaba 2019-12-18 09:42:32 in Ticket [2b8fa6fd] Closed-Leaf check-in: 18fd126bb0 user: oehhar tags: bug-2b8fa6fd
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to library/ttk/scrollbar.tcl.

12
13
14
15
16
17
18





















19
20
21
22
23
24
25
bind TScrollbar <ButtonPress-1> 	{ ttk::scrollbar::Press %W %x %y }
bind TScrollbar <B1-Motion>		{ ttk::scrollbar::Drag %W %x %y }
bind TScrollbar <ButtonRelease-1>	{ ttk::scrollbar::Release %W %x %y }

bind TScrollbar <ButtonPress-2> 	{ ttk::scrollbar::Jump %W %x %y }
bind TScrollbar <B2-Motion>		{ ttk::scrollbar::Drag %W %x %y }
bind TScrollbar <ButtonRelease-2>	{ ttk::scrollbar::Release %W %x %y }






















proc ttk::scrollbar::Scroll {w n units} {
    set cmd [$w cget -command]
    if {$cmd ne ""} {
	uplevel #0 $cmd scroll $n $units
    }
}







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
bind TScrollbar <ButtonPress-1> 	{ ttk::scrollbar::Press %W %x %y }
bind TScrollbar <B1-Motion>		{ ttk::scrollbar::Drag %W %x %y }
bind TScrollbar <ButtonRelease-1>	{ ttk::scrollbar::Release %W %x %y }

bind TScrollbar <ButtonPress-2> 	{ ttk::scrollbar::Jump %W %x %y }
bind TScrollbar <B2-Motion>		{ ttk::scrollbar::Drag %W %x %y }
bind TScrollbar <ButtonRelease-2>	{ ttk::scrollbar::Release %W %x %y }

# Redirect scrollwheel bindings to the scrollbar widget
#
# The shift-bindings scroll left/right (not up/down)
# if a widget has both possibilities
set eventList [list <MouseWheel> <Shift-MouseWheel>]
switch [tk windowingsystem] {
    aqua {
        lappend eventList <Option-MouseWheel> <Shift-Option-MouseWheel>
    }
    x11 {
        lappend eventList <Button-4> <Button-5> \
                <Shift-Button-4> <Shift-Button-5>
        # For tk 8.7, the event list should be extended by
        # <Button-6> <Button-7>
    }
}
foreach event $eventList {
    bind TScrollbar $event [bind Scrollbar $event]
}
unset eventList event

proc ttk::scrollbar::Scroll {w n units} {
    set cmd [$w cget -command]
    if {$cmd ne ""} {
	uplevel #0 $cmd scroll $n $units
    }
}