Tk Source Code

Check-in [5cc8fffe49]
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 | trunk
Files: files | file ages | folders
SHA3-256: 5cc8fffe49275088e9e15ee6d1b08a5d0d2b2c656aa6d854c8d6975441fa4a93
User & Date: oehhar 2020-01-11 17:23:20
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-14
15:57
Consistancy in Key/Button bindings: Use "<Button-1>" in stead of "<1>", "Key" in stead of "KeyPress" and "Button" in stead of "ButtonPress". Also eliminate unnessary "Any" and "Key" modifiers. check-in: b11394e646 user: jan.nijtmans tags: trunk
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
16:21
Update documentation: Add many keysym's which are available now, due to the upgrade to X11R6 compat layer. check-in: d745079b34 user: jan.nijtmans tags: trunk
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> <Button-6> <Button-7>\
                <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
    }
}