Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Merge scrollutil from trunk. Updated release README. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | tklib-0-7-rc |
Files: | files | file ages | folders |
SHA3-256: |
033de041f70d2dd162dbdc54755e314c |
User & Date: | aku 2020-01-08 04:05:29.331 |
Context
2020-01-08
| ||
04:11 | Bump release version to 0.7. check-in: 3e45d98429 user: aku tags: tklib-0-7-rc | |
04:05 | Merge scrollutil from trunk. Updated release README. check-in: 033de041f7 user: aku tags: tklib-0-7-rc | |
04:02 | Updated README check-in: 1de184fef7 user: aku tags: tklib-0-7-rc | |
2020-01-07
| ||
20:19 | * ../../examples/scrollutil/*: Minor improvements; updated the copyright information. check-in: fe0f43f466 user: csaba tags: trunk | |
Changes
Changes to examples/scrollutil/BwScrollableFrmContent.tcl.
1 2 | #============================================================================== # Populates the content frame of the BWidget ScrollableFrame widget created in | | | | > | 1 2 3 4 5 6 7 8 9 10 11 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 | #============================================================================== # Populates the content frame of the BWidget ScrollableFrame widget created in # the demo script BwScrollableFrmDemo2.tcl. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== # # Add some entries to the Tk option database # tablelist::setThemeDefaults if {$ttk::currentTheme eq "aqua"} { option add *Listbox.selectBackground \ $tablelist::themeDefaults(-selectbackground) option add *Listbox.selectForeground \ $tablelist::themeDefaults(-selectforeground) } option add *selectBorderWidth $tablelist::themeDefaults(-selectborderwidth) # # Create some widgets in the content frame # # # A scrolled text widget with old-school mouse wheel support # set row 0 set l [ttk::label $cf.l$row -text \ "Contents of the Tablelist distribution file \"CHANGES.txt\":"] grid $l -row $row -column 0 -columnspan 3 -sticky w -padx 10 -pady {10 0} incr row set _sa [scrollutil::scrollarea $cf.sa$row] set txt [text $_sa.txt -font TkFixedFont -width 73] scrollutil::addMouseWheelSupport $txt $_sa setwidget $txt grid $_sa -row $row -column 0 -columnspan 3 -sticky w -padx 10 -pady {5 0} # # A scrolled listbox widget # incr row |
︙ | ︙ |
Changes to examples/scrollutil/BwScrollableFrmDemo1.tcl.
1 2 3 4 5 6 | #!/usr/bin/env wish #============================================================================== # Demonstrates the use of the Scrollutil package in connection with the BWidget # ScrollableFrame widget. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/usr/bin/env wish #============================================================================== # Demonstrates the use of the Scrollutil package in connection with the BWidget # ScrollableFrame widget. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== package require Tk 8.5 package require BWidget Widget::theme yes package require scrollutil_tile source styleUtil.tcl |
︙ | ︙ |
Changes to examples/scrollutil/BwScrollableFrmDemo2.tcl.
1 2 3 4 5 6 | #!/usr/bin/env wish #============================================================================== # Demonstrates the use of the Scrollutil package in connection with the BWidget # ScrollableFrame widget. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/usr/bin/env wish #============================================================================== # Demonstrates the use of the Scrollutil package in connection with the BWidget # ScrollableFrame widget. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== package require Tk 8.5.9 ;# for ttk::spinbox package require BWidget Widget::theme yes package require mentry_tile 3.2 ;# for mouse wheel support package require tablelist_tile 6.5 ;# for -(x|y)mousewheelwindow |
︙ | ︙ | |||
44 45 46 47 48 49 50 | # # Make the keyboard navigation more user-friendly # foreach w [list $cb $sb $e $me] { bind $w <<TraverseIn>> [list $sf see %W] } foreach w [list $txt $lb $tbl $tv] { | | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | # # Make the keyboard navigation more user-friendly # foreach w [list $cb $sb $e $me] { bind $w <<TraverseIn>> [list $sf see %W] } foreach w [list $txt $lb $tbl $tv] { bind $w <<TraverseIn>> [list seeScrollarea $sf %W] } proc seeScrollarea {sf w} { $sf see [scrollutil::getscrollarea $w] } # # Additional stuff related to the mouse wheel events: # # # Create mouse wheel event bindings for the binding tag "all" and |
︙ | ︙ |
Changes to examples/scrollutil/ScrolledFrmContent.tcl.
1 2 | #============================================================================== # Populates the content frame of the iwidgets::scrolledframe widget created in | | | | > | 1 2 3 4 5 6 7 8 9 10 11 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 | #============================================================================== # Populates the content frame of the iwidgets::scrolledframe widget created in # the demo script ScrolledFrmDemo2.tcl. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== # # Add some entries to the Tk option database # tablelist::setThemeDefaults if {$ttk::currentTheme eq "aqua"} { option add *Listbox.selectBackground \ $tablelist::themeDefaults(-selectbackground) option add *Listbox.selectForeground \ $tablelist::themeDefaults(-selectforeground) } option add *selectBorderWidth $tablelist::themeDefaults(-selectborderwidth) # # Create some widgets in the content frame # # # A scrolled text widget with old-school mouse wheel support # set row 0 set l [ttk::label $cf.l$row -text \ "Contents of the Tablelist distribution file \"CHANGES.txt\":"] grid $l -row $row -column 0 -columnspan 3 -sticky w -padx 10 -pady {10 0} incr row set sa [scrollutil::scrollarea $cf.sa$row] set txt [text $sa.txt -font TkFixedFont -width 73] scrollutil::addMouseWheelSupport $txt $sa setwidget $txt grid $sa -row $row -column 0 -columnspan 3 -sticky w -padx 10 -pady {5 0} # # A scrolled listbox widget # incr row |
︙ | ︙ |
Changes to examples/scrollutil/ScrolledFrmDemo1.tcl.
1 2 3 4 5 6 | #!/usr/bin/env wish #============================================================================== # Demonstrates the use of the Scrollutil package in connection with the # iwidgets::scrolledframe widget. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/usr/bin/env wish #============================================================================== # Demonstrates the use of the Scrollutil package in connection with the # iwidgets::scrolledframe widget. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== package require Tk 8.5 if {[catch {package require iwidgets} result1] != 0 && [catch {package require Iwidgets} result2] != 0} { error "$result1; $result2" } |
︙ | ︙ |
Changes to examples/scrollutil/ScrolledFrmDemo2.tcl.
1 2 3 4 5 6 | #!/usr/bin/env wish #============================================================================== # Demonstrates the use of the Scrollutil package in connection with the # iwidgets::scrolledframe widget. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/usr/bin/env wish #============================================================================== # Demonstrates the use of the Scrollutil package in connection with the # iwidgets::scrolledframe widget. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== package require Tk 8.5.9 ;# for ttk::spinbox if {[catch {package require iwidgets} result1] != 0 && [catch {package require Iwidgets} result2] != 0} { error "$result1; $result2" } |
︙ | ︙ |
Changes to examples/scrollutil/ScrolledTablelist1.tcl.
1 2 3 4 5 6 | #!/usr/bin/env wish #============================================================================== # Demonstrates the traditional scrollbar management in connection with a # tablelist widget. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/usr/bin/env wish #============================================================================== # Demonstrates the traditional scrollbar management in connection with a # tablelist widget. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== package require tablelist_tile 6.3 source styleUtil.tcl wm title . "Scrolled Tablelist" |
︙ | ︙ |
Changes to examples/scrollutil/ScrolledTablelist2.tcl.
1 2 3 4 5 6 | #!/usr/bin/env wish #============================================================================== # Demonstrates the use of the scrollutil::scrollarea widget in connection with # a tablelist. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/usr/bin/env wish #============================================================================== # Demonstrates the use of the scrollutil::scrollarea widget in connection with # a tablelist. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== package require tablelist_tile 6.5 package require scrollutil_tile source styleUtil.tcl wm title . "Scrolled Tablelist" |
︙ | ︙ |
Changes to examples/scrollutil/SuScrollableFrmContent.tcl.
1 2 | #============================================================================== # Populates the content frame of the scrollutil::scrollableframe widget created | | | | > | 1 2 3 4 5 6 7 8 9 10 11 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 | #============================================================================== # Populates the content frame of the scrollutil::scrollableframe widget created # in the demo script SuScrollableFrmDemo2.tcl. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== # # Add some entries to the Tk option database # tablelist::setThemeDefaults if {$ttk::currentTheme eq "aqua"} { option add *Listbox.selectBackground \ $tablelist::themeDefaults(-selectbackground) option add *Listbox.selectForeground \ $tablelist::themeDefaults(-selectforeground) } option add *selectBorderWidth $tablelist::themeDefaults(-selectborderwidth) # # Create some widgets in the content frame # # # A scrolled text widget with old-school mouse wheel support # set row 0 set l [ttk::label $cf.l$row -text \ "Contents of the Tablelist distribution file \"CHANGES.txt\":"] grid $l -row $row -column 0 -columnspan 3 -sticky w -padx 10 -pady {10 0} incr row set _sa [scrollutil::scrollarea $cf.sa$row] set txt [text $_sa.txt -font TkFixedFont -width 73] scrollutil::addMouseWheelSupport $txt $_sa setwidget $txt grid $_sa -row $row -column 0 -columnspan 3 -sticky w -padx 10 -pady {5 0} # # A scrolled listbox widget # incr row |
︙ | ︙ |
Changes to examples/scrollutil/SuScrollableFrmDemo1.tcl.
1 2 3 4 5 6 | #!/usr/bin/env wish #============================================================================== # Demonstrates the use of the Scrollutil package in connection with the # scrollutil::scrollableframe widget. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/usr/bin/env wish #============================================================================== # Demonstrates the use of the Scrollutil package in connection with the # scrollutil::scrollableframe widget. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== package require Tk 8.5 package require scrollutil_tile source styleUtil.tcl wm title . "European Capitals Quiz" |
︙ | ︙ |
Changes to examples/scrollutil/SuScrollableFrmDemo2.tcl.
1 2 3 4 5 6 | #!/usr/bin/env wish #============================================================================== # Demonstrates the use of the Scrollutil package in connection with the # scrollutil::scrollableframe widget. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/usr/bin/env wish #============================================================================== # Demonstrates the use of the Scrollutil package in connection with the # scrollutil::scrollableframe widget. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== package require Tk 8.5.9 ;# for ttk::spinbox package require mentry_tile 3.2 ;# for mouse wheel support package require tablelist_tile 6.5 ;# for -(x|y)mousewheelwindow ;# and scrollutil::scrollarea package require scrollutil_tile |
︙ | ︙ | |||
33 34 35 36 37 38 39 | # # Make the keyboard navigation more user-friendly # foreach w [list $cb $sb $e $me] { bind $w <<TraverseIn>> [list $sf see %W] } foreach w [list $txt $lb $tbl $tv] { | | | | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | # # Make the keyboard navigation more user-friendly # foreach w [list $cb $sb $e $me] { bind $w <<TraverseIn>> [list $sf see %W] } foreach w [list $txt $lb $tbl $tv] { bind $w <<TraverseIn>> [list seeScrollarea $sf %W] } proc seeScrollarea {sf w} { $sf see [scrollutil::getscrollarea $w] } # # Additional stuff related to the mouse wheel events: # # # Create mouse wheel event bindings for the binding tag "all" and |
︙ | ︙ |
Changes to examples/scrollutil/SyncListboxes.tcl.
1 2 3 4 5 6 | #!/usr/bin/env wish #============================================================================== # Demonstrates the use of the scrollutil::scrollsync widget in connection with # two listbox widgets. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/usr/bin/env wish #============================================================================== # Demonstrates the use of the scrollutil::scrollsync widget in connection with # two listbox widgets. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== package require scrollutil_tile source styleUtil.tcl wm title . "European Countries" |
︙ | ︙ |
Changes to examples/scrollutil/SyncTablelists.tcl.
1 2 3 4 5 6 | #!/usr/bin/env wish #============================================================================== # Demonstrates the use of the scrollutil::scrollsync widget in connection with # three tablelist widgets. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/usr/bin/env wish #============================================================================== # Demonstrates the use of the scrollutil::scrollsync widget in connection with # three tablelist widgets. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== package require tablelist_tile package require scrollutil_tile source styleUtil.tcl wm title . "Synchronized Tablelists" |
︙ | ︙ |
Changes to examples/scrollutil/scrolledwidgetPatch.itk.
1 2 3 4 | #============================================================================== # Patch for the iwidgets distribution file scrolledwidget.itk. It replaces the # Tk core scrollbars with ttk::scrollbar widgets. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 | #============================================================================== # Patch for the iwidgets distribution file scrolledwidget.itk. It replaces the # Tk core scrollbars with ttk::scrollbar widgets. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== itcl::body iwidgets::Scrolledwidget::constructor {args} { # # Turn off the borderwidth on the hull # and save off the interior for later use # |
︙ | ︙ |
Changes to examples/scrollutil/styleUtil.tcl.
1 2 3 | #============================================================================== # Patches a few ttk widget styles and defines the style Small.Toolbutton. # | | | 1 2 3 4 5 6 7 8 9 10 11 | #============================================================================== # Patches a few ttk widget styles and defines the style Small.Toolbutton. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== # # On X11 use a slightly patched variant of the "clam" theme # if {[tk windowingsystem] eq "x11"} { ttk::setTheme clam |
︙ | ︙ |
Changes to modules/scrollutil/CHANGES.txt.
|
| | > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 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 | What is new in Scrollutil 1.4? ------------------------------ 1. Added the commands "scrollutil::getscrollarea" and "scrollutil::getscrollsync", designed to query the scrollarea and scrollsync, respectively containing a given widget. 2. Added the command "scrollutil::addMouseWheelSupport", which can be used, e.g., to add mouse wheel support to canvas widgets (thanks to Julian H J Loaring for his proposal) and to restore the "old-school" mouse wheel event handling for text widgets, which performs scrolling by lines and characters rather than pixels. 3. Scrollutil now automatically creates mouse wheel event class bindings for the ttk::scrollbar widget (thanks to Harald Oehlmann for his proposal and discussions on this subject). 4. If a widget that is embedded into a scrollarea is passed to "scrollutil::adaptWheelEventHandling", then this command gets automatically invoked for the scrollbars of that scrollarea, too. 5. Added the missing pieces of code related to the bindings for horizontal scrolling with the aid of mouse buttons 6 and 7 in Tk 8.7.a3 or later on X11. 6. Several improvements in the demo scripts and documentation. What was new in Scrollutil 1.3? ------------------------------- 1. The scrollarea widget of the Scrollutil_tile package now uses ttk::scrollbar widgets on Mac OS X, too, provided that the Tk release is 8.6.10 or later. 2. Improvements related to the scrollsync widget. |
︙ | ︙ |
Changes to modules/scrollutil/COPYRIGHT.txt.
|
| | | | 1 2 3 4 5 6 7 8 9 | Scrolling utilities package Scrollutil 1.4 Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) This library is free software; you can use, modify, and redistribute it for any purpose, provided that existing copyright notices are retained in all copies and that this notice is included verbatim in any distributions. This software is distributed WITHOUT ANY WARRANTY; without even the |
︙ | ︙ |
Changes to modules/scrollutil/ChangeLog.
1 2 3 4 5 6 7 | 2019-12-12 Csaba Nemethi <[email protected]> * ../../examples/scrollutil/SyncListboxes.tcl: Minor improvement. 2019-12-11 Csaba Nemethi <[email protected]> * doc/*.png: Updated. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 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 | 2020-01-07 Csaba Nemethi <[email protected]> * *.tcl: Bumped the version number to 1.4; updated the copyright * COPYRIGHT.txt: information. * CHANGES.txt: Updated to reflect the changes. * README.txt: * scripts/scrollarea.tcl: Added the command "scrollutil::getscrollarea"; updated the copyright information. * scripts/scrollsync.tcl: Added the command "scrollutil::getscrollsync"; updated the copyright information. * scripts/wheelEvent.tcl: Added the command "scrollutil::addMouseWheelSupport; created mouse wheel event class bindings for the ttk::scrollbar widget; automatically invoking "scrollutil::adaptWheelEventHandling" for the scrollbars of the scrollarea whose widget was passed to this command; added the missing pieces of code related to the bindings for mouse buttons 6 and 7 in Tk 8.7.a3 or later on X11; updated the copyright information. * scripts/mwutil.tcl: Minor improvemets; updated the copyright * scripts/scrollableframe.tcl: information. * scripts/tclIndex: Newly generated. * doc/*.html: Updated to reflect the changes; several improvements. * ../../examples/scrollutil/*: Minor improvements; updated the copyright information. 2019-12-12 Csaba Nemethi <[email protected]> * ../../examples/scrollutil/SyncListboxes.tcl: Minor improvement. 2019-12-11 Csaba Nemethi <[email protected]> * doc/*.png: Updated. |
︙ | ︙ |
Changes to modules/scrollutil/README.txt.
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | Scrollutil is a library package for Tcl/Tk versions 8.0 or higher, written in pure Tcl/Tk code. It contains: - the implementation of the "scrollarea", "scrollsync", and "scrollableframe" mega-widgets, including a general utility module for mega-widgets; - commands for user-friendly mouse wheel event handling in scrollable widget containers like scrollutil::scrollableframe, BWidget ScrollableFrame, and iwidgets::scrolledframe. These commands require Tcl/Tk versions 8.4 or higher on X11 and Mac OS X and Tk 8.6b2 or later on Windows; - demo scripts illustrating the use of the Scrollutil package in connection with various scrollable widgets and the above-mentioned | > > > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | Scrollutil is a library package for Tcl/Tk versions 8.0 or higher, written in pure Tcl/Tk code. It contains: - the implementation of the "scrollarea", "scrollsync", and "scrollableframe" mega-widgets, including a general utility module for mega-widgets; - the command "scrollutil::addMouseWheelSupport", which creates mouse wheel event bindings for a given binding tag. This command requires Tcl/Tk 8.4 or later; - commands for user-friendly mouse wheel event handling in scrollable widget containers like scrollutil::scrollableframe, BWidget ScrollableFrame, and iwidgets::scrolledframe. These commands require Tcl/Tk versions 8.4 or higher on X11 and Mac OS X and Tk 8.6b2 or later on Windows; - demo scripts illustrating the use of the Scrollutil package in connection with various scrollable widgets and the above-mentioned |
︙ | ︙ |
Changes to modules/scrollutil/doc/index.html.
1 2 3 | <!DOCTYPE html> <html> <head> | | | > > | | > | > | | | | | 1 2 3 4 5 6 7 8 9 10 11 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 | <!DOCTYPE html> <html> <head> <title>The Scrolling Utilities Package Scrollutil 1.4</title> <meta name="Author" content="Csaba Nemethi"> <meta name="Keywords" content= "mouse wheel event, binding, event handling, scrolling, scrollable widget container, focus, scrollarea, scrollsync, scrollableframe"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body> <div align="center"> <h1>The Scrolling Utilities Package Scrollutil 1.4</h1> <h3>by</h3> <h2>Csaba Nemethi</h2> <address> <a href="mailto:[email protected]">[email protected]</a> </address> </div> <hr> <h2>Contents</h2> <p><a href="scrollutil.html">Scrollutil Programmer's Guide</a></p> <p><a href="scrollarea.html">The <code>scrollutil::scrollarea</code> and <code>scrollutil::getscrollarea</code> Commands</a></p> <p><a href="scrollsync.html">The <code>scrollutil::scrollsync</code> and <code>scrollutil::getscrollsync</code> Commands</a></p> <p><a href="scrollableframe.html">The <code>scrollutil::scrollableframe</code> Command</a></p> <p><a href="wheelEvent.html">Commands Related to Mouse Wheel Event Handling</a></p> </body> </html> |
Changes to modules/scrollutil/doc/scrollableframe.html.
︙ | ︙ | |||
9 10 11 12 13 14 15 | <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body> <div align="center"> <h1>The <code><b>scrollutil::scrollableframe</b></code> Command</h1> | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body> <div align="center"> <h1>The <code><b>scrollutil::scrollableframe</b></code> Command</h1> <h2>For Scrollutil Version 1.4</h2> <h3>by</h3> <h2>Csaba Nemethi</h2> <address> <a href="mailto:[email protected]">[email protected]</a> |
︙ | ︙ | |||
667 668 669 670 671 672 673 | <blockquote> <pre> bind $w <<TraverseIn>> [list $sf <span class="red">see</span> %W] </pre> </blockquote> </dd> | | | > > | | | | > | 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | <blockquote> <pre> bind $w <<TraverseIn>> [list $sf <span class="red">see</span> %W] </pre> </blockquote> </dd> <dd>If the widget <code>$w</code> was embedded into a <a href= "scrollarea.html">scrollarea</a> via the latter's <code><b><a href= "scrollarea.html#setwidget">setwidget</a></b></code> subcommand, and the scrollarea in turn is a descendant of the content frame, then it is more user-friendly to bring the scrollarea into view rather than just the widget:</dd> <dd> <blockquote> <pre> bind $w <<TraverseIn>> [list seeScrollarea $sf %W] proc seeScrollarea {sf w} { $sf <span class="red">see</span> [<b><a href= "scrollarea.html#getscrollarea">scrollutil::getscrollarea</a></b> $w] } </pre> </blockquote> </dd> <dt id="xview"><code><i>pathName</i> <b>xview</b> ?<i>args</i>?</code></dt> |
︙ | ︙ |
Changes to modules/scrollutil/doc/scrollarea.html.
1 2 3 | <!DOCTYPE html> <html> <head> | | > | > | | > | > > > > > | | 1 2 3 4 5 6 7 8 9 10 11 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 47 48 49 50 51 52 53 54 55 56 57 58 | <!DOCTYPE html> <html> <head> <title>The scrollutil::scrollarea and scrollutil::getscrollarea Commands</title> <meta name="Author" content="Csaba Nemethi"> <meta name="Keywords" content="scrollarea, widget, scrollbar"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body> <div align="center"> <h1>The <code><b>scrollutil::scrollarea</b></code> and<br> <code><b>scrollutil::getscrollarea</b></code> Commands</h1> <h2>For Scrollutil Version 1.4</h2> <h3>by</h3> <h2>Csaba Nemethi</h2> <address> <a href="mailto:[email protected]">[email protected]</a> </address> </div> <hr> <h2 id="contents">Contents</h2> <ul> <li><a href="#quick_ref">The <code><b>scrollutil::scrollarea</b></code> Command – Quick Reference</a></li> <li><a href="#detailed_ref">The <code><b>scrollutil::scrollarea</b></code> Command – Detailed Reference</a></li> <li><a href="#getscrollarea">The <code><b>scrollutil::getscrollarea</b></code> Command</a></li> </ul> <div align="center"> <p><a href="index.html">Start page</a></p> </div> <hr> <h2 id="quick_ref">The <code><b>scrollutil::scrollarea</b></code> Command – Quick Reference</h2> <dl> <dt><a href="#name">NAME</a></dt> <dd><code>scrollutil::scrollarea</code> – Create and manipulate scrollarea widgets</dd> |
︙ | ︙ | |||
111 112 113 114 115 116 117 | <div align="center"> <p><a href="#contents">Contents</a> <a href= "index.html">Start page</a></p> </div> <hr> | > | | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | <div align="center"> <p><a href="#contents">Contents</a> <a href= "index.html">Start page</a></p> </div> <hr> <h2 id="detailed_ref">The <code><b>scrollutil::scrollarea</b></code> Command – Detailed Reference</h2> <dl> <dt id="name"><b>NAME</b></dt> <dd><code>scrollutil::scrollarea</code> – Create and manipulate scrollarea widgets</dd> |
︙ | ︙ | |||
550 551 552 553 554 555 556 557 558 559 560 561 562 563 | <dd>When a new scrollarea is created, it has no default event bindings: scrollareas are not intended to be interactive.</dd> <dt class="tm" id="keywords"><b>KEYWORDS</b></dt> <dd>scrollarea, widget, scrollbar</dd> </dl> <div align="center"> <p><a href="#contents">Contents</a> <a href= "index.html">Start page</a></p> </div> </body> </html> | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | <dd>When a new scrollarea is created, it has no default event bindings: scrollareas are not intended to be interactive.</dd> <dt class="tm" id="keywords"><b>KEYWORDS</b></dt> <dd>scrollarea, widget, scrollbar</dd> </dl> <div align="center"> <p><a href="#contents">Contents</a> <a href= "index.html">Start page</a></p> </div> <hr> <h2 id="getscrollarea">The <code><b>scrollutil::getscrollarea</b></code> Command</h2> <dl> <dt><b>NAME</b></dt> <dd><code>scrollutil::getscrollarea</code> – Query the scrollarea containing a given widget</dd> <dt class="tm"><b>SYNOPSIS</b></dt> <dd> <pre> <b>scrollutil::gescrollarea</b> <i>widget</i> </pre> </dd> <dt><b>DESCRIPTION</b></dt> <dd>Returns the path name of the scrollarea into which the widget given by the <code><i>widget</i></code> argument is embedded via the scrollarea's <code><b><a href="#setwidget">setwidget</a></b></code> subcommand, or an empty string if there is no such scrollarea widget.</dd> <dt class="tm"><b>KEYWORDS</b></dt> <dd>scrollarea, widget</dd> </dl> <div align="center"> <p><a href="#contents">Contents</a> <a href= "index.html">Start page</a></p> </div> </body> </html> |
Changes to modules/scrollutil/doc/scrollsync.html.
1 2 3 | <!DOCTYPE html> <html> <head> | | > | > | | > | > > > > > | | 1 2 3 4 5 6 7 8 9 10 11 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 47 48 49 50 51 52 53 54 55 56 57 58 | <!DOCTYPE html> <html> <head> <title>The scrollutil::scrollsync and scrollutil::getscrollsync Commands</title> <meta name="Author" content="Csaba Nemethi"> <meta name="Keywords" content="scrollsync, widget, scrolling"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body> <div align="center"> <h1>The <code><b>scrollutil::scrollsync</b></code> and<br> <code><b>scrollutil::getscrollsync</b></code> Commands</h1> <h2>For Scrollutil Version 1.4</h2> <h3>by</h3> <h2>Csaba Nemethi</h2> <address> <a href="mailto:[email protected]">[email protected]</a> </address> </div> <hr> <h2 id="contents">Contents</h2> <ul> <li><a href="#quick_ref">The <code><b>scrollutil::scrollsync</b></code> Command – Quick Reference</a></li> <li><a href="#detailed_ref">The <code><b>scrollutil::scrollsync</b></code> Command – Detailed Reference</a></li> <li><a href="#getscrollsync">The <code><b>scrollutil::getscrollsync</b></code> Command</a></li> </ul> <div align="center"> <p><a href="index.html">Start page</a></p> </div> <hr> <h2 id="quick_ref">The <code><b>scrollutil::scrollsync</b></code> Command – Quick Reference</h2> <dl> <dt><a href="#name">NAME</a></dt> <dd><code>scrollutil::scrollsync</code> – Create and manipulate scrollsync widgets</dd> |
︙ | ︙ | |||
126 127 128 129 130 131 132 | <div align="center"> <p><a href="#contents">Contents</a> <a href= "index.html">Start page</a></p> </div> <hr> | > | | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | <div align="center"> <p><a href="#contents">Contents</a> <a href= "index.html">Start page</a></p> </div> <hr> <h2 id="detailed_ref">The <code><b>scrollutil::scrollsync</b></code> Command – Detailed Reference</h2> <dl> <dt id="name"><b>NAME</b></dt> <dd><code>scrollutil::scrollsync</code> – Create and manipulate scrollsync widgets</dd> |
︙ | ︙ | |||
387 388 389 390 391 392 393 394 395 396 397 398 399 400 | <dd>When a new scrollsync widget is created, it has no default event bindings: scrollsync widgets are not intended to be interactive.</dd> <dt class="tm" id="keywords"><b>KEYWORDS</b></dt> <dd>scrollsync, widget, scrolling</dd> </dl> <div align="center"> <p><a href="#contents">Contents</a> <a href= "index.html">Start page</a></p> </div> </body> </html> | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | <dd>When a new scrollsync widget is created, it has no default event bindings: scrollsync widgets are not intended to be interactive.</dd> <dt class="tm" id="keywords"><b>KEYWORDS</b></dt> <dd>scrollsync, widget, scrolling</dd> </dl> <div align="center"> <p><a href="#contents">Contents</a> <a href= "index.html">Start page</a></p> </div> <hr> <h2 id="getscrollsync">The <code><b>scrollutil::getscrollsync</b></code> Command</h2> <dl> <dt><b>NAME</b></dt> <dd><code>scrollutil::getscrollsync</code> – Query the scrollsync containing a given widget</dd> <dt class="tm"><b>SYNOPSIS</b></dt> <dd> <pre> <b>scrollutil::gescrollsync</b> <i>widget</i> </pre> </dd> <dt><b>DESCRIPTION</b></dt> <dd>Returns the path name of the scrollsync into which the widget given by the <code><i>widget</i></code> argument is embedded via the scrollsync's <code><b><a href="#setwidgets">setwidgets</a></b></code> subcommand, or an empty string if there is no such scrollsync widget.</dd> <dt class="tm"><b>KEYWORDS</b></dt> <dd>scrollsync, widget</dd> </dl> <div align="center"> <p><a href="#contents">Contents</a> <a href= "index.html">Start page</a></p> </div> </body> </html> |
Changes to modules/scrollutil/doc/scrollutil.html.
︙ | ︙ | |||
10 11 12 13 14 15 16 | <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body> <div align="center"> <h1>Scrollutil Programmer's Guide</h1> | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body> <div align="center"> <h1>Scrollutil Programmer's Guide</h1> <h2>For Scrollutil Version 1.4</h2> <h3>by</h3> <h2>Csaba Nemethi</h2> <address> <a href="mailto:[email protected]">[email protected]</a> |
︙ | ︙ | |||
89 90 91 92 93 94 95 96 97 98 99 100 101 102 | <ul> <li>the implementation of the <a href= "scrollarea.html"><b>scrollarea</b></a>, <a href= "scrollsync.html"><b>scrollsync</b></a>, and <a href= "scrollableframe.html"><b>scrollableframe</b></a> mega-widgets, including a general utility module for mega-widgets;</li> <li>commands for <i>user-friendly</i> mouse wheel event handling in <b>scrollable widget containers</b> like scrollutil::scrollableframe, BWidget ScrollableFrame, and iwidgets::scrolledframe. These commands require Tcl/Tk versions 8.4 or higher on X11 and Mac OS X and Tk 8.6b2 or later on Windows;</li> <li>demo scripts illustrating the use of the Scrollutil package in | > > > > > | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | <ul> <li>the implementation of the <a href= "scrollarea.html"><b>scrollarea</b></a>, <a href= "scrollsync.html"><b>scrollsync</b></a>, and <a href= "scrollableframe.html"><b>scrollableframe</b></a> mega-widgets, including a general utility module for mega-widgets;</li> <li>the command <code><b><a href= "wheelEvent.html#add">scrollutil::addMouseWheelSupport</a></b></code>, which creates mouse wheel event bindings for a given binding tag. This command requires Tcl/Tk 8.4 or later;</li> <li>commands for <i>user-friendly</i> mouse wheel event handling in <b>scrollable widget containers</b> like scrollutil::scrollableframe, BWidget ScrollableFrame, and iwidgets::scrolledframe. These commands require Tcl/Tk versions 8.4 or higher on X11 and Mac OS X and Tk 8.6b2 or later on Windows;</li> <li>demo scripts illustrating the use of the Scrollutil package in |
︙ | ︙ | |||
164 165 166 167 168 169 170 | "https://wiki.tcl-lang.org/page/A+scrolled+frame">https://wiki.tcl-lang.org/page/A+scrolled+frame</a> </address> </blockquote> <p>Scrollutil's canvas-free approach is more lightweight and integrates better in applications that use tile widgets.</p> | | | | | | > | | < | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | "https://wiki.tcl-lang.org/page/A+scrolled+frame">https://wiki.tcl-lang.org/page/A+scrolled+frame</a> </address> </blockquote> <p>Scrollutil's canvas-free approach is more lightweight and integrates better in applications that use tile widgets.</p> <p>From the point of view of <b>the commands related to mouse wheel event handling</b> provided by the Scrollutil package, the scrollability of a widget or widget container window means that the associated Tcl command supports the <code>xview scroll <i>number</i> units</code> and <code>yview scroll <i>number</i> units</code> subcommands. The reason for requiring at least Tk version 8.6b2 on Windows for the commands related to scrollable widget containers is that in earlier Tk versions on this platform the mouse wheel events were sent to the widget having the focus rather than to the one under the pointer.</p> <p>To make use of the user-friendly mouse wheel event handling via the Scrollutil package, follow the steps below:</p> <ul> <li>Create mouse wheel event bindings for the binding tag <code>"all"</code> or for the toplevel widgets (including <code>"."</code>) |
︙ | ︙ | |||
212 213 214 215 216 217 218 | <li class="tm">For some widgets it can be desirable to make the focus check within this modified event handling less restrictive. For example, if the widget under the pointer is an entry component of a <a href= "https://www.nemethi.de/mentry/">mentry</a> of type <code>"Date"</code>, <code>"Time"</code>, <code>"DateTime"</code>, <code>"IPAddr"</code>, or <code>"IPv6Addr"</code> and the focus is on any of its siblings, then the | | | | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | <li class="tm">For some widgets it can be desirable to make the focus check within this modified event handling less restrictive. For example, if the widget under the pointer is an entry component of a <a href= "https://www.nemethi.de/mentry/">mentry</a> of type <code>"Date"</code>, <code>"Time"</code>, <code>"DateTime"</code>, <code>"IPAddr"</code>, or <code>"IPv6Addr"</code> and the focus is on any of its siblings, then the mouse wheel events sent to this entry should be handled by the entry widget itself rather than scrolling the widget container that is an ascendant of the mentry. The <code><a href= "wheelEvent.html#setFocusCkWin">scrollutil::setFocusCheckWindow</a></code> command covers exactly cases like this.</li> </ul> <p>The mouse wheel event handling with the aid of the Scrollutil package was also tested to work with the <code>scrolledframe::scrolledframe</code> |
︙ | ︙ | |||
237 238 239 240 241 242 243 | <blockquote> <address> <a href="https://www.nemethi.de">https://www.nemethi.de</a> </address> </blockquote> | | | | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | <blockquote> <address> <a href="https://www.nemethi.de">https://www.nemethi.de</a> </address> </blockquote> <p>The distribution file is <code>scrollutil1.4.tar.gz</code> for UNIX and <code>scrollutil1_4.zip</code> for Windows. These files contain the same information, except for the additional carriage return character preceding the linefeed at the end of each line in the text files for Windows.</p> <p>Scrollutil is also included in tklib, which has the address</p> <blockquote> |
︙ | ︙ | |||
262 263 264 265 266 267 268 | a directory at the same level as the Tcl and Tk script libraries. The locations of these library directories are given by the <code>tcl_library</code> and <code>tk_library</code> variables, respectively.</p> <p>To install Scrollutil <i>on UNIX</i>, <code>cd</code> to the desired directory and unpack the distribution file | | | | | | | | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | a directory at the same level as the Tcl and Tk script libraries. The locations of these library directories are given by the <code>tcl_library</code> and <code>tk_library</code> variables, respectively.</p> <p>To install Scrollutil <i>on UNIX</i>, <code>cd</code> to the desired directory and unpack the distribution file <code>scrollutil1.4.tar.gz</code>:</p> <blockquote> <pre> gunzip -c scrollutil1.4.tar.gz | tar -xf - </pre> </blockquote> <p>On most UNIX systems this can be replaced with</p> <blockquote> <pre> tar -zxf scrollutil1.4.tar.gz </pre> </blockquote> <p>Both commands will create a directory named <code>scrollutil1.4</code>, with the subdirectories <code>demos</code>, <code>doc</code>, and <code>scripts</code>.</p> <p><i>On Windows</i>, use WinZip or some other program capable of unpacking the distribution file <code>scrollutil1_4.zip</code> into the directory <code>scrollutil1.4</code>, with the subdirectories <code>demos</code>, <code>doc</code>, and <code>scripts</code>.</p> <p>Notice that in tklib the Scrollutil <code>demos</code> directory is replaced with the subdirectory <code>scrollutil</code> of the <code>examples</code> directory. Please take this into account when reading the <a href="#examples">examples</a> below.</p> |
︙ | ︙ | |||
893 894 895 896 897 898 899 | event bindings for the binding tag <code>"all"</code> with the aid of the <code><a href= "wheelEvent.html#create">scrollutil::createWheelEventBindings</a></code> command, and invokes the <code><a href= "wheelEvent.html#enable">scrollutil::enableScrollingByWheel</a></code> command for this scrolledframe, thus registering the latter for scrolling by these bindings. After that it populates the content frame of the | | | | 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 | event bindings for the binding tag <code>"all"</code> with the aid of the <code><a href= "wheelEvent.html#create">scrollutil::createWheelEventBindings</a></code> command, and invokes the <code><a href= "wheelEvent.html#enable">scrollutil::enableScrollingByWheel</a></code> command for this scrolledframe, thus registering the latter for scrolling by these bindings. After that it populates the content frame of the scrolledframe with the same widgets as <code>SuScrollableFrmDemo1.tcl</code> and <code>BwScrollableFrmDemo1.tcl</code> in the two previous examples.</p> <p>Here is the relevant code:</p> <blockquote> <pre> package require Tk 8.5 if {[catch {package require iwidgets} result1] != 0 && |
︙ | ︙ | |||
935 936 937 938 939 940 941 | <span class="cmt"># # Get the content frame and populate it #</span> set cf [$sf childsite] . . . | | | 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 | <span class="cmt"># # Get the content frame and populate it #</span> set cf [$sf childsite] . . . <i><exactly as in the two previous examples, except the stuff related to keyboard navigation></i> . . . </pre> </blockquote> <p>The code related to keyboard navigation is not present in this example, because the iwidgets::scrolledframe widget doesn't provide a <code>see</code> |
︙ | ︙ | |||
1024 1025 1026 1027 1028 1029 1030 | <span class="cmt"># # Make the keyboard navigation more user-friendly #</span> foreach w [list $cb $sb $e $me] { bind $w <<TraverseIn>> [list <span class="red">$sf see %W</span>] } foreach w [list $txt $lb $tbl $tv] { | | | | > > | | > > > > | 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 | <span class="cmt"># # Make the keyboard navigation more user-friendly #</span> foreach w [list $cb $sb $e $me] { bind $w <<TraverseIn>> [list <span class="red">$sf see %W</span>] } foreach w [list $txt $lb $tbl $tv] { bind $w <<TraverseIn>> [list seeScrollarea $sf %W] } proc seeScrollarea {sf w} { <span class="red">$sf see [scrollutil::getscrollarea $w]</span> } </pre> </blockquote> <p>Whenever the <code><<TraverseIn>></code> virtual event is sent to one of the four widgets created within scrollareas, we query the path name of the corresponding scrollarea via <code><a href= "scrollarea.html#getscrollarea">scrollutil::getscrollarea</a></code> and bring that scrollarea (including the scrollbars and the border) into view rather than just the widget in question. While <i>in this script</i> we could have used <code>[winfo parent]</code> instead, the command <code>scrollutil::getscrollarea</code> is the recommended one, being that it works also for widgets that are no children of the corresponding scrollareas.</p> <p>Here is the additional stuff related to the mouse wheel events, using the Scrollutil commands described in the <a href="#ov_what">What Is Scrollutil?</a> section:</p> <blockquote> <pre> |
︙ | ︙ | |||
1083 1084 1085 1086 1087 1088 1089 | the scrolled text, listbox, tablelist, and ttk::treeview widgets are created within <a href="scrollarea.html">scrollarea</a> widgets:</p> <blockquote> <pre> <span class="red">set _sa [scrollutil::scrollarea ...]</span> set txt [text $_sa.txt -font TkFixedFont -width 73] | > | | 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 | the scrolled text, listbox, tablelist, and ttk::treeview widgets are created within <a href="scrollarea.html">scrollarea</a> widgets:</p> <blockquote> <pre> <span class="red">set _sa [scrollutil::scrollarea ...]</span> set txt [text $_sa.txt -font TkFixedFont -width 73] <span class="red">scrollutil::addMouseWheelSupport $txt $_sa setwidget $txt</span> grid $_sa ... . . . <span class="red">set _sa [scrollutil::scrollarea ...]</span> set lb [listbox $_sa.lb -width 0] <span class="red">$_sa setwidget $lb</span> |
︙ | ︙ | |||
1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 | Tcl commands to set the <code>-borderwidth</code> option of the text, listbox, and tablelist widgets to <code>0</code>. On the other hand, for the ttk::treeview we use a scrollarea widget with <code>-borderwidth 0</code>, because the ttk::treeview has a border of width <code>1</code> and doesn't support the <code>-borderwidth</code> configuration option.</p> <p>The file <code>SuScrollableFrmContent.tcl</code> contains also the implementation of the procedure <code>configTablelist</code>, associated with the "Configure Tablelist Widget" button as the value of its <code>-command</code> option. This procedure opens a toplevel window that contains a <a href= "scrollableframe.html">scrollutil::scrollableframe</a> widget created with the <code><a href= | > > > > > > | 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 | Tcl commands to set the <code>-borderwidth</code> option of the text, listbox, and tablelist widgets to <code>0</code>. On the other hand, for the ttk::treeview we use a scrollarea widget with <code>-borderwidth 0</code>, because the ttk::treeview has a border of width <code>1</code> and doesn't support the <code>-borderwidth</code> configuration option.</p> <p>For our text widget we prefer a mouse wheel event handling that scrolls the widget by lines rather than pixels, as done by the <code>Text</code> class bindings in Tk 8.5 and later; we achieve this by passing the path name <code>$txt</code> to the <code><a href= "wheelEvent.html#add">scrollutil::addMouseWeelSupport</a></code> command.</p> <p>The file <code>SuScrollableFrmContent.tcl</code> contains also the implementation of the procedure <code>configTablelist</code>, associated with the "Configure Tablelist Widget" button as the value of its <code>-command</code> option. This procedure opens a toplevel window that contains a <a href= "scrollableframe.html">scrollutil::scrollableframe</a> widget created with the <code><a href= |
︙ | ︙ | |||
1212 1213 1214 1215 1216 1217 1218 | <span class="cmt"># # Make the keyboard navigation more user-friendly #</span> foreach w [list $cb $sb $e $me] { bind $w <<TraverseIn>> [list $sf see %W] } foreach w [list $txt $lb $tbl $tv] { | | | | 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 | <span class="cmt"># # Make the keyboard navigation more user-friendly #</span> foreach w [list $cb $sb $e $me] { bind $w <<TraverseIn>> [list $sf see %W] } foreach w [list $txt $lb $tbl $tv] { bind $w <<TraverseIn>> [list seeScrollarea $sf %W] } proc seeScrollarea {sf w} { $sf see [<span class="red">scrollutil::getscrollarea $w</span>] } </pre> </blockquote> <p>The additional stuff related to the mouse wheel events contains exactly the same Scrollutil command invocations as the one in the previous example.</p> |
︙ | ︙ | |||
1254 1255 1256 1257 1258 1259 1260 | <h3 id="ex_ScrolledFrameDemo2">A Script Using Two iwidgets::scrolledframe Widgets</h3> <p>The script <code>ScrolledFrmDemo2.tcl</code> in the <code>demos</code> directory creates an iwidgets::scrolledframe widget and then <code>source</code>s the file <code>ScrolledFrmContent.tcl</code>, which populates the content frame of the scrolledframe with the same widgets as | > | < | 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 | <h3 id="ex_ScrolledFrameDemo2">A Script Using Two iwidgets::scrolledframe Widgets</h3> <p>The script <code>ScrolledFrmDemo2.tcl</code> in the <code>demos</code> directory creates an iwidgets::scrolledframe widget and then <code>source</code>s the file <code>ScrolledFrmContent.tcl</code>, which populates the content frame of the scrolledframe with the same widgets as <code>SuScrollableFrmContent.tcl</code> and <code>BwScrollableFrmContent.tcl</code> in the two previous examples.</p> <p>Here is the relevant code:</p> <blockquote> <pre> package require Tk 8.5.9 ;<span class= "cmt"># for ttk::spinbox</span> |
︙ | ︙ | |||
1300 1301 1302 1303 1304 1305 1306 | set cf [$sf childsite] . . . source ScrolledFrmContent.tcl </pre> </blockquote> <p>The additional stuff related to the mouse wheel events contains exactly | | | | > > > | | | | 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 | set cf [$sf childsite] . . . source ScrolledFrmContent.tcl </pre> </blockquote> <p>The additional stuff related to the mouse wheel events contains exactly the same Scrollutil command invocations as the one in the two previous examples.</p> <p>The file <code>ScrolledFrmContent.tcl</code> contains also the implementation of the procedure <code>configTablelist</code>, associated with the "Configure Tablelist Widget" button as the value of its <code>-command</code> option. This procedure opens a toplevel window that contains an iwidgets::scrolledframe widget with a manually implemented equivalent of the <code><a href= "scrollableframe.html#fitcontentwidth">-fitcontentwidth</a> yes</code> <a href="scrollableframe.html">scrollutil::scrollableframe</a> and <code>-constrainedwidth yes</code> BWidget ScrollableFrame settings and invokes the <code><a href= "wheelEvent.html#enable">scrollutil::enableScrollingByWheel</a></code> command for this scrolledframe, thus registering the latter for scrolling by the already created mouse wheel event bindings for the binding tag <code>"all"</code>. After that it populates the content frame of the scrolledframe with ttk::label, ttk::combobox, ttk::spinbox, ttk::entry, and ttk::checkbutton widgets used to display and edit the configuration options of the tablelist widget. Whenever a ttk::combobox or ttk::spinbox is created, the <code><a href= "wheelEvent.html#adapt">scrollutil::adaptWheelEventHandling</a></code> command is invoked for it, being that these widgets have built-in bindings for the mouse wheel events.</p> <p>Again, all this is nearly identical to what we did in the two previous examples.</p> <div align="center"> <p><a href="#contents">Contents</a> <a href= "index.html">Start page</a></p> </div> </body> </html> |
Changes to modules/scrollutil/doc/wheelEvent.html.
1 2 3 | <!DOCTYPE html> <html> <head> | | < | < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | <!DOCTYPE html> <html> <head> <title>Commands Related to Mouse Wheel Event Handling</title> <meta name="Author" content="Csaba Nemethi"> <meta name="Keywords" content= "mouse wheel event, binding, event handling, scrolling, scrollable widget container, focus"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body> <div align="center"> <h1>Commands Related to Mouse Wheel Event Handling</h1> <h2>For Scrollutil Version 1.4</h2> <h3>by</h3> <h2>Csaba Nemethi</h2> <address> <a href="mailto:[email protected]">[email protected]</a> </address> </div> <hr> <h2 id="contents">Contents</h2> <ul> <li><a href="#add">The <code><b>scrollutil::addMouseWheelSupport</b></code> Command</a></li> <li><a href="#create">The <code><b>scrollutil::createWheelEventBindings</b></code> Command</a></li> <li><a href="#enable">The <code><b>scrollutil::enableScrollingByWheel</b></code> Command</a></li> <li><a href="#adapt">The <code><b>scrollutil::adaptWheelEventHandling</b></code> Command</a></li> <li><a href="#setFocusCkWin">The <code><b>scrollutil::setFocusCheckWindow</b></code> Command</a></li> <li><a href="#focusCkWin">The <code><b>scrollutil::focusCheckWindow</b></code> Command</a></li> </ul> <div align="center"> <p><a href="index.html">Start page</a></p> </div> <hr> <h2 id="add">The <code><b>scrollutil::addMouseWheelSupport</b></code> Command</h2> <dl> <dt><b>NAME</b></dt> <dd><code>scrollutil::addMouseWheelSupport</code> – Add mouse wheel support</dd> <dt class="tm"><b>SYNOPSIS</b></dt> <dd> <pre> <b>scrollutil::addMouseWheelSupport</b> <i>tag</i> ?<i>axes</i>? </pre> </dd> <dt><b>DESCRIPTION</b></dt> <dd>Adds mouse wheel support to the widgets having the specified binding tag by creating bindings for the mouse wheel events along the axes given by the optional <code><i>axes</i></code> argument, which must be <code>xy</code> (the default, meaning both the x and y axis), <code>x</code> (meaning the x axis only), or <code>y</code> (meaning the y axis only). The binding scripts created by this command will scroll the window given by the <code><b>%W</b></code> event field with the aid of the <code><b>xview scroll</b> <i>number</i> <b>units</b></code> and <code><b>yview scroll</b> <i>number</i> <b>units</b></code> subcommands of the associated Tcl command.</dd> <dd class="tm"><b>REMARK 1:</b> If <code><i>tag</i></code> is the path name of a window then the binding scripts created by this command are terminated by an invocation of the <code><b>break</b></code> command, in order to prevent the processing of the mouse wheel events by further binding scripts. For example, if <code><i>tag</i></code> is the path name of a text widget then the terminating <code><b>break</b></code> command makes sure that the mouse wheel events will not <i>additionally</i> be processed by the class bindings (associated with the binding tag <code><b>Text</b></code>), which in Tk 8.5 and later trigger a scrolling by <i>pixels</i>, unlike the bindings created by this command, which scroll the widget by <i>units</i> (i.e., lines and characters).</dd> <dd class="tm"><b>REMARK 2:</b> The canvas widget has no built-in bindings, but you can use this command to add mouse wheel support to the widget class <code><b>Canvas</b></code> or individual canvas widgets.</dd> <dd class="tm"><b>REMARK 3:</b> The mouse wheel events along the vertical axis are <code><b><MouseWheel></b></code> on Windows, <code><b><MouseWheel></b></code> and <code><b><Option-MouseWheel></b></code> on Mac OS X, and <code><b><MouseWheel></b></code>, <code><b><Button-4></b></code> and <code><b><Button-5></b></code> on X11 (where <code><b><MouseWheel></b></code> is not triggered by the X server, but can be produced using <code><b>event generate</b></code>). The mouse wheel events along the horizontal axis are <code><b><Shift-MouseWheel></b></code> on Windows, <code><b><Shift-MouseWheel></b></code> and <code><b><Shift-Option-MouseWheel></b></code> on Mac OS X, and <code><b><Shift-MouseWheel></b></code>, <code><b><Shift-Button-4></b></code> and <code><b><Shift-Button-5></b></code> on X11 (where <code><b><Shift-MouseWheel></b></code> is not triggered by the X server, but can be produced using <code><b>event generate</b></code>). On X11, when using Tk 8.7a3 or later, there are two more mouse wheel events along the horizontal axis: <code><b><Button-6></b></code> and <code><b><Button-7></b></code>, which are handled just like <code><b><Shift-Button-4></b></code> and <code><b><Shift-Button-5></b></code>, respectively. These events are commonly triggered by left/right tilting the scroll wheel of a mouse having one or two additional (thumb) buttons. (In Tk versions 8.6.x, with x >= 10, left/right tilting the scroll wheel of such a mouse gives rise to <code><b><Shift-MouseWheel></b></code> events on Windows and Mac OS X Aqua, and to <code><b><Shift-Button-4></b></code> and <code><b><Shift-Button-5></b></code> events on X11.)</dd> <dt class="tm"><b>KEYWORDS</b></dt> <dd>mouse wheel event, binding, scrolling</dd> </dl> <div align="center"> <p><a href="#contents">Contents</a> <a href= "index.html">Start page</a></p> </div> <hr> <h2 id="create">The <code><b>scrollutil::createWheelEventBindings</b></code> Command</h2> <dl> <dt><b>NAME</b></dt> |
︙ | ︙ | |||
78 79 80 81 82 83 84 | scrollable widget containers having the same toplevel as the widget and registered via <code><b><a href= "#enable">scrollutil::enableScrollingByWheel</a></b></code> then these events will trigger a scrolling of that widget container. In case of several nested registered scrollable widget containers fulfilling these conditions the innermost one will be scrolled. Each <code><i>tag</i></code> argument must be <code><b>all</b></code> or the | | > | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | scrollable widget containers having the same toplevel as the widget and registered via <code><b><a href= "#enable">scrollutil::enableScrollingByWheel</a></b></code> then these events will trigger a scrolling of that widget container. In case of several nested registered scrollable widget containers fulfilling these conditions the innermost one will be scrolled. Each <code><i>tag</i></code> argument must be <code><b>all</b></code> or the path name of an existing toplevel widget (including <code><b>.</b></code>).</dd> <dd class="tm"><b>REMARK:</b> The reason for restricting the <code><i>tag</i></code> arguments to <code><b>all</b></code> and path names of existing toplevel widgets rather than supporting also tags like <code>"Scrollableframe"</code> (for scrollutil::scrollableframe), <code>"BwScrollableFrame"</code> (for BWidget ScrollableFrame) or <code>"Scrolledframe"</code> (for iwidgets::scrolledframe) is that the mouse wheel events should trigger a scrolling of the widget container under the pointer not only if the widget under the pointer is the widget container itself but also if it is a descendant of the latter (recall that for each window, the path name of its nearest toplevel ancestor and the tag <code><b>all</b></code> are contained in the window's default list of binding tags).</dd> <dt class="tm"><b>KEYWORDS</b></dt> <dd>mouse wheel event, binding, scrolling, scrollable widget container</dd> </dl> <div align="center"> |
︙ | ︙ | |||
278 279 280 281 282 283 284 | </ul> </dd> <dd class="tm"><b>REMARK 1:</b> This command is designed to be invoked for widgets that have mouse wheel event bindings and are descendants of a scrollable widget container (although it does no harm if it is called for other widgets, too). The Tk and tile widgets having | | | > > > > | | | | > > > > > > > > > > > > > > > > > > | | | | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | </ul> </dd> <dd class="tm"><b>REMARK 1:</b> This command is designed to be invoked for widgets that have mouse wheel event bindings and are descendants of a scrollable widget container (although it does no harm if it is called for other widgets, too). The Tk and tile widgets having class bindings for mouse wheel events are: listbox, text, Tk core scrollbar, ttk::scrollbar, ttk::combobox, ttk::spinbox, and ttk::treeview. Note that the ttk::scrollbar widget has no <i>built-in</i> class bindings for the mouse wheel events, but Scrollutil automatically creates the missing bindings by copying the mouse wheel event bindings of the widget class <code><b>Scrollbar</b></code> to the binding tag <code><b>TScrollbar</b></code>. Examples of widgets with binding tags other than their class names that have mouse wheel event bindings are tablelist widgets as well as the entry components of <a href= "https://www.nemethi.de/mentry/">mentry</a> widgets of type <code>"Date"</code>, <code>"Time"</code>, <code>"DateTime"</code>, <code>"IPAddr"</code>, and <code>"IPv6Addr"</code> (for Mentry versions 3.2 and above).</dd> <dd class="tm"><b>REMARK 2:</b> As mentioned above, Tk core scrollbar and ttk::scrollbar widgets have class bindings for mouse wheel events, hence this command should be invoked for them in case they are descendants of a scrollable widget container. Since this task can become tedious, Scrollutil makes sure that if you pass a widget to this command and that widget is embedded into a <a href="scrollarea.html">scrollarea</a> via the latter's <code><b><a href= "scrollarea.html#setwidget">setwidget</a></b></code> subcommand, then this command will automatically be invoked for the scrollbars of that scrollarea, too.</dd> <dd class="tm"><b>REMARK 3:</b> When handling a mouse wheel event sent to a Tk core or tile scrollbar whose path name was passed to this command, if the focus is on or inside the associated widget then the event will be processed by the scrollbar rather than being redirected to the containing toplevel, just as if the focus were on the scrollbar itself.</dd> <dd class="tm"><b>REMARK 4:</b> Invoking this command for widgets that have mouse wheel event bindings and are descendants of a scrollable widget container is essential for a user-friendly mouse wheel event handling in scrollable widget containers. Without this step the mouse wheel events would scroll both the listbox, text, ttk::treeview, or tablelist widget under the pointer <i>and</i> the widget container to whose descendants the latter belongs, or they would select the next/previous value in the ttk::combobox or ttk::spinbox under the pointer <i>in addition to</i> scrolling the widget container. After invoking this command, e.g, for a listbox within a scrollable widget container, the mouse wheel events over that widget will only scroll the listbox if it has the focus. Likewise, after invoking this command for a ttk::combobox or ttk::spinbox within a scrollable widget container, the mouse wheel events over that widget will only select its next/previous value if it has the focus. In both examples, if the focus is outside the widget in question then the mouse wheel events will scroll the widget container instead.</dd> <dt class="tm"><b>KEYWORDS</b></dt> <dd>mouse wheel event, binding, event handling, scrolling, scrollable |
︙ | ︙ | |||
360 361 362 363 364 365 366 | some widgets you want to make the focus check within the binding scripts for the tag <code><b>WheeleventRedir</b></code> less restrictive. For example, if the widget under the pointer is an entry component of a <a href="https://www.nemethi.de/mentry/">mentry</a> <code><i>me</i></code> of type <code>"Date"</code>, <code>"Time"</code>, <code>"DateTime"</code>, <code>"IPAddr"</code>, or <code>"IPv6Addr"</code> and the focus is on any of its siblings, then the mouse wheel events sent to this entry should be | | | | > | | | > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 | some widgets you want to make the focus check within the binding scripts for the tag <code><b>WheeleventRedir</b></code> less restrictive. For example, if the widget under the pointer is an entry component of a <a href="https://www.nemethi.de/mentry/">mentry</a> <code><i>me</i></code> of type <code>"Date"</code>, <code>"Time"</code>, <code>"DateTime"</code>, <code>"IPAddr"</code>, or <code>"IPv6Addr"</code> and the focus is on any of its siblings, then the mouse wheel events sent to this entry should be handled by the entry widget itself rather than scrolling the widget container that is an ascendant of the mentry. You can achieve this by invoking</dd> <dd> <blockquote> <pre> set entryList [$me <a href= "https://www.nemethi.de/mentry/mentryWidget.html#entries">entries</a>] eval <a href="#adapt">scrollutil::adaptWheelEventHandling</a> $entryList eval <span class="red">scrollutil::setFocusCheckWindow</span> $entryList [list $me] </pre> </blockquote> </dd> <dd>With Tcl/Tk 8.5 or above, you can use the more compact form</dd> <dd> <blockquote> <pre> set entryList [$me <a href= "https://www.nemethi.de/mentry/mentryWidget.html#entries">entries</a>] <a href="#adapt">scrollutil::adaptWheelEventHandling</a> {*}$entryList <span class="red">scrollutil::setFocusCheckWindow</span> {*}$entryList $me </pre> </blockquote> </dd> <dd class="tm"><b>REMARK 3:</b> As a similar example, suppose that <code><i>ss</i></code> is a <a href="scrollsync.html">scrollsync</a> widget that was populated via its <code><b><a href= "scrollsync.html#setwidgets">setwidgets</a></b></code> subcommand with child widgets. Then, if the widget under the pointer is one of these children and the focus is on any of the other children passed to that subcommand, then the mouse wheel events sent to the child under the pointer should be handled by that child widget itself rather than scrolling the widget container that is an ascendant of the scrollsync. You can achieve this with the following code:</dd> <dd> <blockquote> <pre> set widgetList [$ss <a href="scrollsync.html#widgets">widgets</a>] eval <a href="#adapt">scrollutil::adaptWheelEventHandling</a> $widgetList eval <span class="red">scrollutil::setFocusCheckWindow</span> $widgetList [list $ss] </pre> </blockquote> </dd> <dd>Again, with Tcl/Tk 8.5 or above, you can use the more compact form</dd> <dd> <blockquote> <pre> set widgetList [$ss <a href="scrollsync.html#widgets">widgets</a>] <a href="#adapt">scrollutil::adaptWheelEventHandling</a> {*}$widgetList <span class="red">scrollutil::setFocusCheckWindow</span> {*}$widgetList $ss </pre> </blockquote> </dd> <dt class="tm"><b>KEYWORDS</b></dt> <dd>binding, focus, "focus check window"</dd> |
︙ | ︙ |
Changes to modules/scrollutil/pkgIndex.tcl.
1 2 3 | #============================================================================== # Scrollutil and Scrollutil_tile package index file. # | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #============================================================================== # Scrollutil and Scrollutil_tile package index file. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== # # Regular packages: # package ifneeded scrollutil 1.4 \ [list source [file join $dir scrollutil.tcl]] package ifneeded scrollutil_tile 1.4 \ [list source [file join $dir scrollutil_tile.tcl]] # # Aliases: # package ifneeded Scrollutil 1.4 \ [list package require -exact scrollutil 1.4] package ifneeded Scrollutil_tile 1.4 \ [list package require -exact scrollutil_tile 1.4] # # Code common to all packages: # package ifneeded scrollutil::common 1.4 \ [list source [file join $dir scrollutilCommon.tcl]] |
Changes to modules/scrollutil/scripts/mwutil.tcl.
1 2 3 4 5 6 7 | #============================================================================== # Contains utility procedures for mega-widgets. # # Structure of the module: # - Namespace initialization # - Public utility procedures # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #============================================================================== # Contains utility procedures for mega-widgets. # # Structure of the module: # - Namespace initialization # - Public utility procedures # # Copyright (c) 2000-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== package require Tk 8 # # Namespace initialization # ======================== |
︙ | ︙ |
Changes to modules/scrollutil/scripts/scrollableframe.tcl.
1 2 3 4 5 6 7 8 9 10 11 | #============================================================================== # Contains the implementation of the scrollableframe widget. # # Structure of the module: # - Namespace initialization # - Private procedure creating the default bindings # - Public procedure creating a new scrollableframe widget # - Private configuration procedures # - Private procedures implementing the scrollableframe widget command # - Private procedures used in bindings # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #============================================================================== # Contains the implementation of the scrollableframe widget. # # Structure of the module: # - Namespace initialization # - Private procedure creating the default bindings # - Public procedure creating a new scrollableframe widget # - Private configuration procedures # - Private procedures implementing the scrollableframe widget command # - Private procedures used in bindings # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== # # Namespace initialization # ======================== # |
︙ | ︙ | |||
517 518 519 520 521 522 523 | return -code error "bad window path name \"$w\"" } upvar ::scrollutil::ns${win}::data data set cf $data(cf) if {[string first $cf. $w] != 0} { return -code error \ | | | < | < | 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | return -code error "bad window path name \"$w\"" } upvar ::scrollutil::ns${win}::data data set cf $data(cf) if {[string first $cf. $w] != 0} { return -code error \ "widget $w is not a descendant of the content frame of $win" } if {[string compare [winfo toplevel $w] [winfo toplevel $win]] != 0} { return -code error "widgets $w and $win have different toplevels" } if {[string length [winfo manager $w]] == 0} { return -code error "widget $w is not managed by any geometry manager" } # # Parse the optional argument # if {$argCount == 1} { set xSide w |
︙ | ︙ |
Changes to modules/scrollutil/scripts/scrollarea.tcl.
1 2 3 4 5 6 | #============================================================================== # Contains the implementation of the scrollarea widget. # # Structure of the module: # - Namespace initialization # - Private procedure creating the default bindings | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #============================================================================== # Contains the implementation of the scrollarea widget. # # Structure of the module: # - Namespace initialization # - Private procedure creating the default bindings # - Public procedures creating or quering a scrollarea widget # - Private configuration procedures # - Private procedures implementing the scrollarea widget command # - Private callback procedures # - Private procedures used in bindings # - Private utility procedures # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== # # Namespace initialization # ======================== # |
︙ | ︙ | |||
133 134 135 136 137 138 139 | bind WidgetOfScrollarea <Destroy> { scrollutil::sa::onWidgetOfScrollareaDestroy %W } } # | | | | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | bind WidgetOfScrollarea <Destroy> { scrollutil::sa::onWidgetOfScrollareaDestroy %W } } # # Public procedures creating or quering a scrollarea widget # ========================================================= # #------------------------------------------------------------------------------ # scrollutil::scrollarea # # Creates a new scrollarea widget whose name is specified as the first command- # line argument, and configures it according to the options and their values |
︙ | ︙ | |||
246 247 248 249 250 251 252 253 254 255 256 257 258 259 | # rename ::$win sa::$win interp alias {} ::$win {} scrollutil::sa::scrollareaWidgetCmd $win return $win } # # Private configuration procedures # ================================ # #------------------------------------------------------------------------------ # scrollutil::sa::doConfig | > > > > > > > > > > > > > > > > > > > | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | # rename ::$win sa::$win interp alias {} ::$win {} scrollutil::sa::scrollareaWidgetCmd $win return $win } #------------------------------------------------------------------------------ # scrollutil::getscrollarea # # Queries the scrollarea into which a given widget is embedded via the # scrollarea's setwidget subcommand. #------------------------------------------------------------------------------ proc scrollutil::getscrollarea widget { variable sa::scrollareaArr if {[info exists scrollareaArr($widget)]} { set win $scrollareaArr($widget) if {[winfo exists $win] && [string compare [winfo class $win] "Scrollarea"] == 0} { return $win } } return "" } # # Private configuration procedures # ================================ # #------------------------------------------------------------------------------ # scrollutil::sa::doConfig |
︙ | ︙ | |||
315 316 317 318 319 320 321 | -xscrollbarmode { variable scrollbarModes set val \ [mwutil::fullOpt "scrollbar mode" $val $scrollbarModes] if {[string compare $val "none"] != 0 && [winfo exists $data(widget)]} { if {![mwutil::isScrollable $data(widget) x]} { | | | 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | -xscrollbarmode { variable scrollbarModes set val \ [mwutil::fullOpt "scrollbar mode" $val $scrollbarModes] if {[string compare $val "none"] != 0 && [winfo exists $data(widget)]} { if {![mwutil::isScrollable $data(widget) x]} { return -code error "widget $data(widget) fails to\ support horizontal scrolling" } } set data($opt) $val set tagList [bindtags $win.hsb] set idx [lsearch -exact $tagList "DynamicHScrollbar"] |
︙ | ︙ | |||
347 348 349 350 351 352 353 | -yscrollbarmode { variable scrollbarModes set val \ [mwutil::fullOpt "scrollbar mode" $val $scrollbarModes] if {[string compare $val "none"] != 0 && [winfo exists $data(widget)]} { if {![mwutil::isScrollable $data(widget) y]} { | | | 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | -yscrollbarmode { variable scrollbarModes set val \ [mwutil::fullOpt "scrollbar mode" $val $scrollbarModes] if {[string compare $val "none"] != 0 && [winfo exists $data(widget)]} { if {![mwutil::isScrollable $data(widget) y]} { return -code error "widget $data(widget) fails to\ support vertical scrolling" } } set data($opt) $val switch $val { static { showVScrollbar $win } |
︙ | ︙ | |||
446 447 448 449 450 451 452 453 454 | # Processes the scrollarea setwidget subcommmand. #------------------------------------------------------------------------------ proc scrollutil::sa::setwidgetSubCmd {win widget} { variable scrollareaArr upvar ::scrollutil::ns${win}::data data if {[winfo exists $widget]} { if {[string compare $data(-xscrollbarmode) "none"] != 0} { if {![mwutil::isScrollable $widget x]} { | > > > > > > | | | | | 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 | # Processes the scrollarea setwidget subcommmand. #------------------------------------------------------------------------------ proc scrollutil::sa::setwidgetSubCmd {win widget} { variable scrollareaArr upvar ::scrollutil::ns${win}::data data if {[winfo exists $widget]} { set sa [::scrollutil::getscrollarea $widget] if {[string length $sa] != 0 && [string compare $sa $win] != 0} { return -code error \ "widget $widget already in another scrollarea $sa" } if {[string compare $data(-xscrollbarmode) "none"] != 0} { if {![mwutil::isScrollable $widget x]} { return -code error \ "widget $widget fails to support horizontal scrolling" } } if {[string compare $data(-yscrollbarmode) "none"] != 0} { if {![mwutil::isScrollable $widget y]} { return -code error \ "widget $widget fails to support vertical scrolling" } } } elseif {[string length $widget] != 0} { return -code error "bad window path name \"$widget\"" } set oldWidget $data(widget) |
︙ | ︙ | |||
679 680 681 682 683 684 685 | } #------------------------------------------------------------------------------ # scrollutil::sa::onWidgetOfScrollareaDestroy #------------------------------------------------------------------------------ proc scrollutil::sa::onWidgetOfScrollareaDestroy widget { variable scrollareaArr | | | | | | > | 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 | } #------------------------------------------------------------------------------ # scrollutil::sa::onWidgetOfScrollareaDestroy #------------------------------------------------------------------------------ proc scrollutil::sa::onWidgetOfScrollareaDestroy widget { variable scrollareaArr if {[info exists scrollareaArr($widget)]} { unset scrollareaArr($widget) } set win [::scrollutil::getscrollarea $widget] if {[string length $win] != 0} { ::$win setwidget "" } } #------------------------------------------------------------------------------ # scrollutil::sa::onHeaderHeightChanged #------------------------------------------------------------------------------ |
︙ | ︙ |
Changes to modules/scrollutil/scripts/scrollsync.tcl.
1 2 3 4 5 6 | #============================================================================== # Contains the implementation of the scrollsync widget. # # Structure of the module: # - Namespace initialization # - Private procedure creating the default bindings | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #============================================================================== # Contains the implementation of the scrollsync widget. # # Structure of the module: # - Namespace initialization # - Private procedure creating the default bindings # - Public procedures creating or quering a scrollsync widget # - Private configuration procedures # - Private procedures implementing the scrollsync widget command # - Private callback procedure # - Private procedures used in bindings # - Private utility procedures # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== # # Namespace initialization # ======================== # |
︙ | ︙ | |||
118 119 120 121 122 123 124 | bind WidgetOfScrollsync <Destroy> { scrollutil::ss::onWidgetOfScrollsyncDestroy %W } } # | | | | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | bind WidgetOfScrollsync <Destroy> { scrollutil::ss::onWidgetOfScrollsyncDestroy %W } } # # Public procedures creating or quering a scrollsync widget # ========================================================= # #------------------------------------------------------------------------------ # scrollutil::scrollsync # # Creates a new scrollsync widget whose name is specified as the first command- # line argument, and configures it according to the options and their values |
︙ | ︙ | |||
202 203 204 205 206 207 208 209 210 211 212 213 214 215 | # one and create an alias of the original name for a new widget procedure # rename ::$win ss::$win interp alias {} ::$win {} scrollutil::ss::scrollsyncWidgetCmd $win return $win } # # Private configuration procedures # ================================ # #------------------------------------------------------------------------------ | > > > > > > > > > > > > > > > > > > > | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | # one and create an alias of the original name for a new widget procedure # rename ::$win ss::$win interp alias {} ::$win {} scrollutil::ss::scrollsyncWidgetCmd $win return $win } #------------------------------------------------------------------------------ # scrollutil::getscrollsync # # Queries the scrollsync into which a given widget is embedded via the # scrollsync's setwidgets subcommand. #------------------------------------------------------------------------------ proc scrollutil::getscrollsync widget { variable ss::scrollsyncArr if {[info exists scrollsyncArr($widget)]} { set win $scrollsyncArr($widget) if {[winfo exists $win] && [string compare [winfo class $win] "Scrollsync"] == 0} { return $win } } return "" } # # Private configuration procedures # ================================ # #------------------------------------------------------------------------------ |
︙ | ︙ | |||
330 331 332 333 334 335 336 337 338 339 340 341 342 343 | # Processes the scrollsync setwidgets subcommmand. #------------------------------------------------------------------------------ proc scrollutil::ss::setwidgetsSubCmd {win widgetList} { foreach w $widgetList { if {![winfo exists $w]} { return -code error "bad window path name \"$w\"" } } variable scrollsyncArr variable xViewArr variable yViewArr upvar ::scrollutil::ns${win}::data data | > > > > > | 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | # Processes the scrollsync setwidgets subcommmand. #------------------------------------------------------------------------------ proc scrollutil::ss::setwidgetsSubCmd {win widgetList} { foreach w $widgetList { if {![winfo exists $w]} { return -code error "bad window path name \"$w\"" } set ss [::scrollutil::getscrollsync $w] if {[string length $ss] != 0 && [string compare $ss $win] != 0} { return -code error "widget $w already in another scrollsync $ss" } } variable scrollsyncArr variable xViewArr variable yViewArr upvar ::scrollutil::ns${win}::data data |
︙ | ︙ | |||
507 508 509 510 511 512 513 | } #------------------------------------------------------------------------------ # scrollutil::ss::onWidgetOfScrollsyncDestroy #------------------------------------------------------------------------------ proc scrollutil::ss::onWidgetOfScrollsyncDestroy widget { variable scrollsyncArr | | | | | | > > | | | 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | } #------------------------------------------------------------------------------ # scrollutil::ss::onWidgetOfScrollsyncDestroy #------------------------------------------------------------------------------ proc scrollutil::ss::onWidgetOfScrollsyncDestroy widget { variable scrollsyncArr if {[info exists scrollsyncArr($widget)]} { unset scrollsyncArr($widget) } variable xViewArr if {[info exists xViewArr($widget)]} { unset xViewArr($widget) } variable yViewArr if {[info exists yViewArr($widget)]} { unset yViewArr($widget) } set win [::scrollutil::getscrollsync $widget] if {[string length $win] != 0} { set widgetList [::$win widgets] set idx [lsearch -exact $widgetList $widget] ::$win setwidgets [lreplace $widgetList $idx $idx] } } # |
︙ | ︙ |
Changes to modules/scrollutil/scripts/tclIndex.
︙ | ︙ | |||
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | set auto_index(::scrollutil::sf::createBindings) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::scrollableframe) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::doConfig) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::doCget) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::updateHorizPlaceOpts) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::updateVertPlaceOpts) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::scrollableframeWidgetCmd) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::seeSubCmd) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::xviewSubCmd) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::yviewSubCmd) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::roundUp) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::roundDn) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::roundUpOrDn) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::applyOffset) [list source [file join $dir scrollableframe.tcl]] | > | | > > > > < < < < < < < < < < < < < < < < < < > > > > | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | set auto_index(::scrollutil::sf::createBindings) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::scrollableframe) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::doConfig) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::doCget) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::updateHorizPlaceOpts) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::updateVertPlaceOpts) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::scrollableframeWidgetCmd) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::scanSubCmd) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::seeSubCmd) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::xviewSubCmd) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::yviewSubCmd) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::roundUp) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::roundDn) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::roundUpOrDn) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::applyOffset) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::onScrollableframeMfConfigure) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::onScrollableframeCfConfigure) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::onButton1) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::onB1Motion) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sf::onButtonRelease1) [list source [file join $dir scrollableframe.tcl]] set auto_index(::scrollutil::sa::extendConfigSpecs) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::createBindings) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::scrollarea) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::getscrollarea) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::doConfig) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::doCget) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::scrollareaWidgetCmd) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::setwidgetSubCmd) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::setHScrollbar) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::setVScrollbar) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::onScrollareaConfigure) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::updateScrollbars) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::onDynamicHScrollbarMap) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::onWidgetOfScrollareaDestroy) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::onHeaderHeightChanged) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::onTitleColsWidthChanged) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::showHScrollbar) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::hideHScrollbar) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::updateHScrollbar) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::showVScrollbar) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::hideVScrollbar) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::updateVScrollbar) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::sa::unlockScrollbar) [list source [file join $dir scrollarea.tcl]] set auto_index(::scrollutil::ss::extendConfigSpecs) [list source [file join $dir scrollsync.tcl]] set auto_index(::scrollutil::ss::createBindings) [list source [file join $dir scrollsync.tcl]] set auto_index(::scrollutil::scrollsync) [list source [file join $dir scrollsync.tcl]] set auto_index(::scrollutil::getscrollsync) [list source [file join $dir scrollsync.tcl]] set auto_index(::scrollutil::ss::doConfig) [list source [file join $dir scrollsync.tcl]] set auto_index(::scrollutil::ss::doCget) [list source [file join $dir scrollsync.tcl]] set auto_index(::scrollutil::ss::scrollsyncWidgetCmd) [list source [file join $dir scrollsync.tcl]] set auto_index(::scrollutil::ss::setwidgetsSubCmd) [list source [file join $dir scrollsync.tcl]] set auto_index(::scrollutil::ss::viewSubCmd) [list source [file join $dir scrollsync.tcl]] set auto_index(::scrollutil::ss::scrollCmd) [list source [file join $dir scrollsync.tcl]] set auto_index(::scrollutil::ss::updateMasterWidgets) [list source [file join $dir scrollsync.tcl]] set auto_index(::scrollutil::ss::onWidgetOfScrollsyncDestroy) [list source [file join $dir scrollsync.tcl]] set auto_index(::scrollutil::ss::sortScrollableList) [list source [file join $dir scrollsync.tcl]] set auto_index(::scrollutil::ss::compareViews) [list source [file join $dir scrollsync.tcl]] set auto_index(::scrollutil::ss::unlockView) [list source [file join $dir scrollsync.tcl]] set auto_index(::scrollutil::createBindings) [list source [file join $dir wheelEvent.tcl]] set auto_index(::scrollutil::addMouseWheelSupport) [list source [file join $dir wheelEvent.tcl]] set auto_index(::scrollutil::createWheelEventBindings) [list source [file join $dir wheelEvent.tcl]] set auto_index(::scrollutil::enableScrollingByWheel) [list source [file join $dir wheelEvent.tcl]] set auto_index(::scrollutil::adaptWheelEventHandling) [list source [file join $dir wheelEvent.tcl]] set auto_index(::scrollutil::setFocusCheckWindow) [list source [file join $dir wheelEvent.tcl]] set auto_index(::scrollutil::focusCheckWindow) [list source [file join $dir wheelEvent.tcl]] set auto_index(::scrollutil::hasFocus) [list source [file join $dir wheelEvent.tcl]] set auto_index(::scrollutil::isCompatible) [list source [file join $dir wheelEvent.tcl]] set auto_index(::scrollutil::comparePaths) [list source [file join $dir wheelEvent.tcl]] set auto_index(::scrollutil::scrollByUnits) [list source [file join $dir wheelEvent.tcl]] set auto_index(::scrollutil::mayScroll) [list source [file join $dir wheelEvent.tcl]] set auto_index(::scrollutil::onScrlWidgetContDestroy) [list source [file join $dir wheelEvent.tcl]] |
Changes to modules/scrollutil/scripts/wheelEvent.tcl.
1 | #============================================================================== | | > | | | | | > | < < < | < > | > > > > > > > > > > > > > > > > | | > > > > | | > > | | > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | #============================================================================== # Contains procedures related to mouse wheel event handling in scrollable # widgets and scrollable widget containers like scrollutil::scrollableframe, # BWidget ScrollableFrame, and iwidgets::scrolledframe. Tested also with the # scrolledframe::scrolledframe command of the Scrolledframe package by Maurice # Bredelet (ulis) and its optimized and enhanced version contributed by Keith # Nash, as well as with the sframe command implemented by Paul Walton (see # https://wiki.tcl-lang.org/ page/A+scrolled+frame). # # Structure of the module: # - Namespace initialization # - Private procedure creating mouse wheel event and <Destroy> bindings # - Public procedures # - Private procedures # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== package require Tk 8.4 # # Namespace initialization # ======================== # namespace eval scrollutil { variable winSys [tk windowingsystem] # # The list of scrollable widget containers that are # registered for scrolling by the mouse wheel event # bindings created by the createWheelEventBindings command: # variable scrlWidgetContList {} } # # Private procedure creating mouse wheel event and <Destroy> bindings # =================================================================== # #------------------------------------------------------------------------------ # scrollutil::createBindings # # Creates mouse wheel event bindings for the binding tags TScrollbar, # WheeleventRedir, and WheeleventBreak, as well as <Destroy> bindings for the # binding tags ScrlWidgetCont and WheeleventWidget. #------------------------------------------------------------------------------ proc scrollutil::createBindings {} { variable winSys set eventList [list <MouseWheel> <Shift-MouseWheel>] switch $winSys { aqua { lappend eventList <Option-MouseWheel> <Shift-Option-MouseWheel> } x11 { lappend eventList <Button-4> <Button-5> \ <Shift-Button-4> <Shift-Button-5> if {[package vcompare $::tk_patchLevel "8.7a3"] >= 0} { lappend eventList <Button-6> <Button-7> } } } foreach event $eventList { bind TScrollbar $event [bind Scrollbar $event] } if {$winSys eq "win32" && [package vcompare $::tk_patchLevel "8.6b2"] < 0} { return "" } foreach event $eventList { if {[string match <*Button-?> $event]} { bind WheeleventRedir $event [format { if {![scrollutil::hasFocus %%W] || ![scrollutil::isCompatible %s %%W]} { event generate [winfo toplevel %%W] %s \ -rootx %%X -rooty %%Y |
︙ | ︙ | |||
59 60 61 62 63 64 65 | break } } $event $event] } bind WheeleventBreak $event { break } } | < < < < < < < < < < < | < | < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | < < < < < < < | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | break } } $event $event] } bind WheeleventBreak $event { break } } bind ScrlWidgetCont <Destroy> { scrollutil::onScrlWidgetContDestroy %W } bind WheeleventWidget <Destroy> { unset -nocomplain scrollutil::focusCheckWinArr(%W) } } # # Public procedures # ================= # #------------------------------------------------------------------------------ # scrollutil::addMouseWheelSupport # # Usage: scrollutil::addMouseWheelSupport tag ?(xy|x|y)? # # Creates mouse wheel event bindings for the specified binding tag and optional # axes, which must be "xy" (the default), "x", or "y". #------------------------------------------------------------------------------ proc scrollutil::addMouseWheelSupport {tag {axes "xy"}} { set isWindow [string match .* $tag] if {$isWindow} { if {![winfo exists $tag]} { return -code error "bad window path name \"$tag\"" } } if {$axes ne "xy" && $axes ne "x" && $axes ne "y"} { return -code error "bad axes \"$axes\": must be xy, x, or y" } if {$isWindow} { if {[string first "x" $axes] >= 0 && [catch {$tag xview scroll 0 units}] != 0} { return -code error \ "widget $tag fails to support horizontal scrolling by units" } if {[string first "y" $axes] >= 0 && [catch {$tag yview scroll 0 units}] != 0} { return -code error \ "widget $tag fails to support vertical scrolling by units" } set tail "; break" } else { set tail "" } variable winSys if {[string first "y" $axes] >= 0} { if {$winSys eq "aqua"} { bind $tag <MouseWheel> \ [format {%%W yview scroll [expr {-(%%D)}] units%s} $tail] bind $tag <Option-MouseWheel> \ [format {%%W yview scroll [expr {-10 * (%%D)}] units%s} $tail] } else { bind $tag <MouseWheel> \ [format {%%W yview scroll [expr {%%D >= 0 ?\ (-%%D) / 30 : (-(%%D) + 29) / 30}] units%s} $tail] if {$winSys eq "x11"} { bind $tag <Button-4> \ [format {%%W yview scroll -5 units%s} $tail] bind $tag <Button-5> \ [format {%%W yview scroll 5 units%s} $tail] } } } if {[string first "x" $axes] >= 0} { if {$winSys eq "aqua"} { bind $tag <Shift-MouseWheel> \ [format {%%W xview scroll [expr {-(%%D)}] units%s} $tail] bind $tag <Shift-Option-MouseWheel> \ [format {%%W xview scroll [expr {-10 * (%%D)}] units%s} $tail] } else { bind $tag <Shift-MouseWheel> \ [format {%%W xview scroll [expr {%%D >= 0 ?\ (-%%D) / 30 : (-(%%D) + 29) / 30}] units%s} $tail] if {$winSys eq "x11"} { bind $tag <Shift-Button-4> \ [format {%%W xview scroll -5 units%s} $tail] bind $tag <Shift-Button-5> \ [format {%%W xview scroll 5 units%s} $tail] if {[package vcompare $::tk_patchLevel "8.7a3"] >= 0} { bind $tag <Button-6> \ [format {%%W xview scroll -5 units%s} $tail] bind $tag <Button-7> \ [format {%%W xview scroll 5 units%s} $tail] } } } } } #------------------------------------------------------------------------------ # scrollutil::createWheelEventBindings # # Usage: scrollutil::createWheelEventBindings ?tag tag ...? # # Creates mouse wheel event bindings for the specified binding tags such that # if the widget under the pointer is (a descendant of) one of the registered # scrollable widget containers then these events will trigger a scrolling of # that widget container. In case of several nested registered scrollable # widget containers fulfilling this condition the innermost one will be # scrolled. Each tag argument must be "all" or the path name of an existing # toplevel widget. #------------------------------------------------------------------------------ proc scrollutil::createWheelEventBindings args { variable winSys if {$winSys eq "win32"} { package require Tk 8.6b2 } foreach tag $args { if {[string match .* $tag]} { if {![winfo exists $tag]} { return -code error "bad window path name \"$tag\"" } if {[winfo toplevel $tag] ne $tag} { return -code error "$tag is not a toplevel widget" } } elseif {$tag ne "all"} { return -code error "unsupported tag \"$tag\": must be all or the\ path name of an existing toplevel widget" } if {$winSys eq "aqua"} { bind $tag <MouseWheel> { scrollutil::scrollByUnits %W %X %Y y [expr {-(%D)}] } bind $tag <Option-MouseWheel> { scrollutil::scrollByUnits %W %X %Y y [expr {-10 * (%D)}] } bind $tag <Shift-MouseWheel> { scrollutil::scrollByUnits %W %X %Y x [expr {-(%D)}] } bind $tag <Shift-Option-MouseWheel> { scrollutil::scrollByUnits %W %X %Y x [expr {-10 * (%D)}] } } else { bind $tag <MouseWheel> { scrollutil::scrollByUnits %W %X %Y y \ [expr {%D >= 0 ? (-%D) / 30 : (-(%D) + 29) / 30}] } bind $tag <Shift-MouseWheel> { scrollutil::scrollByUnits %W %X %Y x \ [expr {%D >= 0 ? (-%D) / 30 : (-(%D) + 29) / 30}] |
︙ | ︙ | |||
185 186 187 188 189 190 191 192 193 194 195 196 197 198 | # Usage: scrollutil::enableScrollingByWheel ?scrlWidgetCont scrlWidgetCont ...? # # Adds the specified scrollable widget containers to the internal list of # widget containers that are registered for scrolling by the mouse wheel event # bindings created by the createWheelEventBindings command. #------------------------------------------------------------------------------ proc scrollutil::enableScrollingByWheel args { variable scrlWidgetContList foreach swc $args { if {![winfo exists $swc]} { return -code error "bad window path name \"$swc\"" } if {[catch {$swc xview scroll 0 units}] != 0} { | > > > > > | | | | | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | # Usage: scrollutil::enableScrollingByWheel ?scrlWidgetCont scrlWidgetCont ...? # # Adds the specified scrollable widget containers to the internal list of # widget containers that are registered for scrolling by the mouse wheel event # bindings created by the createWheelEventBindings command. #------------------------------------------------------------------------------ proc scrollutil::enableScrollingByWheel args { variable winSys if {$winSys eq "win32"} { package require Tk 8.6b2 } variable scrlWidgetContList foreach swc $args { if {![winfo exists $swc]} { return -code error "bad window path name \"$swc\"" } if {[catch {$swc xview scroll 0 units}] != 0} { return -code error \ "widget $swc fails to support horizontal scrolling by units" } if {[catch {$swc yview scroll 0 units}] != 0} { return -code error \ "widget $swc fails to support vertical scrolling by units" } if {[lsearch -exact $scrlWidgetContList $swc] >= 0} { continue } lappend scrlWidgetContList $swc |
︙ | ︙ | |||
245 246 247 248 249 250 251 | # # - If the focus is outside the window [focusCheckWindow $widget] then # the event will be redirected to the containing toplevel window via # event generate rather than being handled by the binding script # associated with the above-mentioned tag. #------------------------------------------------------------------------------ proc scrollutil::adaptWheelEventHandling args { | > > > > | | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | # # - If the focus is outside the window [focusCheckWindow $widget] then # the event will be redirected to the containing toplevel window via # event generate rather than being handled by the binding script # associated with the above-mentioned tag. #------------------------------------------------------------------------------ proc scrollutil::adaptWheelEventHandling args { variable winSys if {$winSys eq "win32"} { package require Tk 8.6b2 } foreach w $args { if {![winfo exists $w]} { return -code error "bad window path name \"$w\"" } set wTop [winfo toplevel $w] if {[winfo class $w] eq "Tablelist"} { |
︙ | ︙ | |||
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | set tagIdx [lsearch -exact $tagList $tag] bindtags $w [lreplace $tagList $tagIdx $tagIdx \ WheeleventRedir $tag WheeleventBreak] break } } } } #------------------------------------------------------------------------------ # scrollutil::setFocusCheckWindow # # Usage: scrollutil::setFocusCheckWindow widget ?widget ...? otherWidget # # For each widget argument, the command sets the associated "focus check # window" to otherWidget. This is the window to be used instead of the widget # when checking whether the focus is on/inside or outside that window. It must # be an ancestor of or identical to widget. #------------------------------------------------------------------------------ proc scrollutil::setFocusCheckWindow args { set argCount [llength $args] if {$argCount < 2} { return -code error "wrong # args: should be\ \"scrollutil::setFocusCheckWindow widget ?widget ...? otherWidget\"" } foreach w $args { | > > > > > > > > > > > > > > | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | set tagIdx [lsearch -exact $tagList $tag] bindtags $w [lreplace $tagList $tagIdx $tagIdx \ WheeleventRedir $tag WheeleventBreak] break } } # # If $w is embedded into a scrollarea then invoke this # procedure for the scrollbars of that scrollarea, too # set sa [getscrollarea $w] if {$sa ne ""} { adaptWheelEventHandling $sa.hsb $sa.vsb } } } #------------------------------------------------------------------------------ # scrollutil::setFocusCheckWindow # # Usage: scrollutil::setFocusCheckWindow widget ?widget ...? otherWidget # # For each widget argument, the command sets the associated "focus check # window" to otherWidget. This is the window to be used instead of the widget # when checking whether the focus is on/inside or outside that window. It must # be an ancestor of or identical to widget. #------------------------------------------------------------------------------ proc scrollutil::setFocusCheckWindow args { variable winSys if {$winSys eq "win32"} { package require Tk 8.6b2 } set argCount [llength $args] if {$argCount < 2} { return -code error "wrong # args: should be\ \"scrollutil::setFocusCheckWindow widget ?widget ...? otherWidget\"" } foreach w $args { |
︙ | ︙ | |||
312 313 314 315 316 317 318 | foreach w $args { if {$n == $argCount - 1} { return "" } if {[string first $w2. $w.] != 0} { return -code error \ | | | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | foreach w $args { if {$n == $argCount - 1} { return "" } if {[string first $w2. $w.] != 0} { return -code error \ "widget $w2 is neither an ancestor of nor is identical to $w" } set focusCheckWinArr($w) $w2 set tagList [bindtags $w] if {[lsearch -exact $tagList "WheeleventWidget"] < 0} { bindtags $w [linsert $tagList 1 WheeleventWidget] |
︙ | ︙ | |||
337 338 339 340 341 342 343 344 345 346 347 348 349 350 | # # Returns the "focus check window" associated with widget. This is the window # that is used instead of the widget when checking whether the focus is # on/inside or outside that window. If the command setFocusCheckWindow was not # invoked for widget then the return value is widget itself. #------------------------------------------------------------------------------ proc scrollutil::focusCheckWindow w { if {![winfo exists $w]} { return -code error "bad window path name \"$w\"" } variable focusCheckWinArr return [expr {[info exists focusCheckWinArr($w)] ? $focusCheckWinArr($w) : $w}] | > > > > > | 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | # # Returns the "focus check window" associated with widget. This is the window # that is used instead of the widget when checking whether the focus is # on/inside or outside that window. If the command setFocusCheckWindow was not # invoked for widget then the return value is widget itself. #------------------------------------------------------------------------------ proc scrollutil::focusCheckWindow w { variable winSys if {$winSys eq "win32"} { package require Tk 8.6b2 } if {![winfo exists $w]} { return -code error "bad window path name \"$w\"" } variable focusCheckWinArr return [expr {[info exists focusCheckWinArr($w)] ? $focusCheckWinArr($w) : $w}] |
︙ | ︙ | |||
389 390 391 392 393 394 395 | set idx [lsearch -exact $tagList "WheeleventRedir"] set tag [lindex $tagList [incr idx]] if {[bind $tag $event] eq ""} { return 0 } elseif {[string match "*Scrollbar" [winfo class $w]]} { set orient [$w cget -orient] return [expr { | | > | > | 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | set idx [lsearch -exact $tagList "WheeleventRedir"] set tag [lindex $tagList [incr idx]] if {[bind $tag $event] eq ""} { return 0 } elseif {[string match "*Scrollbar" [winfo class $w]]} { set orient [$w cget -orient] return [expr { ($orient eq "horizontal" && ([string match {<Shift-*>} $event] \ || [string match {<Button-[67]>} $event])) || ($orient eq "vertical" && !([string match {<Shift-*>} $event] \ || [string match {<Button-[67]>} $event])) }] } else { return 1 } } #------------------------------------------------------------------------------ |
︙ | ︙ |
Changes to modules/scrollutil/scrollutil.tcl.
1 2 3 | #============================================================================== # Main Scrollutil package module. # | | | > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #============================================================================== # Main Scrollutil package module. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== package require -exact scrollutil::common 1.4 package provide scrollutil $::scrollutil::version package provide Scrollutil $::scrollutil::version ::scrollutil::useTile 0 ::scrollutil::sa::createBindings ::scrollutil::ss::createBindings ::scrollutil::sf::createBindings if {[package vcompare $::tk_version "8.4"] >= 0} { ::scrollutil::createBindings } |
Changes to modules/scrollutil/scrollutilCommon.tcl.
1 2 3 | #============================================================================== # Main Scrollutil and Scrollutil_tile package module. # | | | > > > > > | | | | | | 1 2 3 4 5 6 7 8 9 10 11 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 | #============================================================================== # Main Scrollutil and Scrollutil_tile package module. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== package require Tk 8 namespace eval ::scrollutil { # # Public variables: # variable version 1.4 variable library if {$::tcl_version >= 8.4} { set library [file dirname [file normalize [info script]]] } else { set library [file dirname [info script]] ;# no "file normalize" yet } # # Creates a new scrollarea/scrollsync/scrollableframe widget: # namespace export scrollarea scrollsync scrollableframe # # Queries the scrollarea/scrollsync to which a given widget belongs: # namespace export getscrollarea getscrollsync # # Public procedures for mouse wheel event handling in # scrollable widgets and scrollable widget containers: # namespace export addMouseWheelSupport createWheelEventBindings \ enableScrollingByWheel adaptWheelEventHandling \ setFocusCheckWindow focusCheckWindow } package provide scrollutil::common $::scrollutil::version # # The following procedure, invoked in "scrollutil.tcl" and # "scrollutil_tile.tcl", sets the variable ::scrollutil::usingTile to the given |
︙ | ︙ |
Changes to modules/scrollutil/scrollutil_tile.tcl.
1 2 3 | #============================================================================== # Main Scrollutil_tile package module. # | | | > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #============================================================================== # Main Scrollutil_tile package module. # # Copyright (c) 2019-2020 Csaba Nemethi (E-mail: [email protected]) #============================================================================== package require Tk 8.4 if {$::tk_version < 8.5 || [regexp {^8\.5a[1-5]$} $::tk_patchLevel]} { package require tile 0.6 } package require -exact scrollutil::common 1.4 package provide scrollutil_tile $::scrollutil::version package provide Scrollutil_tile $::scrollutil::version ::scrollutil::useTile 1 ::scrollutil::sa::createBindings ::scrollutil::ss::createBindings ::scrollutil::sf::createBindings if {[package vcompare $::tk_version "8.4"] >= 0} { ::scrollutil::createBindings } |
Changes to support/releases/history/README-0.7.txt.
︙ | ︙ | |||
11 12 13 14 15 16 17 | ================ Module Package New Version Comments --------------------- --------------------- ------------- ---------- canvas canvas::gradient 0.2 notifywindow notifywindow 1.0 persistentSelection persistentSelection 1.0b1 | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ================ Module Package New Version Comments --------------------- --------------------- ------------- ---------- canvas canvas::gradient 0.2 notifywindow notifywindow 1.0 persistentSelection persistentSelection 1.0b1 scrollutil scrollutil::common 1.4 widgetPlus widgetPlus 1.0b2 --------------------- --------------------- ------------- ---------- Changes from tklib 0.6 to 0.6 ============================= tklib 0.6 tklib 0.6 |
︙ | ︙ |