Tk Library Source Code
Check-in [dc658ef333]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.

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

Overview
Comment:Merged the changes for Scrollutil 1.5 from trunk to release.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tklib-0-7-rc
Files: files | file ages | folders
SHA3-256:dc658ef3338ffb40e209d76e735823452e428056d974f7fc48aeabf0c346876c
User & Date: csaba 2020-02-07 16:36:21
Context
2020-02-09
20:42
Regenerated local documentation for scrollutil update. check-in: 50d59b6817 user: aku tags: tklib-0-7-rc
2020-02-07
16:36
Merged the changes for Scrollutil 1.5 from trunk to release. check-in: dc658ef333 user: csaba tags: tklib-0-7-rc
2020-02-06
14:09
* doc/scrollutil.html: Minor improvements. check-in: f38162f408 user: csaba tags: trunk
2020-01-13
01:16
Merged README fixes from trunk to release. check-in: 4498e3a6bb user: aku tags: tklib-0-7-rc
2020-01-10
16:00
* README.txt: Updated the version number. check-in: 41393b6c9d user: csaba tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to examples/scrollutil/BwScrollableFrmDemo1.tcl.

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
..
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#==============================================================================
# Demonstrates the use of the Scrollutil package in connection with the BWidget
# ScrollableFrame widget.
#
# Copyright (c) 2019-2020  Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
#==============================================================================

package require Tk 8.5
package require BWidget
Widget::theme yes
package require scrollutil_tile
source styleUtil.tcl

wm title . "European Capitals Quiz"

................................................................................

foreach country $countryList capital $capitalList {
    set capitalArr($country) $capital
}

set capitalList [lsort $capitalList]

if {$ttk::currentTheme in {aqua vista xpnative}} {
    set topPadY 2
} else {
    set topPadY 5
}
set padY [list $topPadY 0]

set row 0







<







 







|







3
4
5
6
7
8
9

10
11
12
13
14
15
16
..
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#==============================================================================
# Demonstrates the use of the Scrollutil package in connection with the BWidget
# ScrollableFrame widget.
#
# Copyright (c) 2019-2020  Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
#==============================================================================


package require BWidget
Widget::theme yes
package require scrollutil_tile
source styleUtil.tcl

wm title . "European Capitals Quiz"

................................................................................

foreach country $countryList capital $capitalList {
    set capitalArr($country) $capital
}

set capitalList [lsort $capitalList]

if {[lsearch -exact {aqua vista xpnative} $ttk::currentTheme] >= 0} {
    set topPadY 2
} else {
    set topPadY 5
}
set padY [list $topPadY 0]

set row 0

Changes to examples/scrollutil/ScrolledFrmDemo1.tcl.

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
..
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#==============================================================================
# Demonstrates the use of the Scrollutil package in connection with the
# iwidgets::scrolledframe widget.
#
# Copyright (c) 2019-2020  Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
#==============================================================================

package require Tk 8.5
if {[catch {package require iwidgets} result1] != 0 &&
    [catch {package require Iwidgets} result2] != 0} {
    error "$result1; $result2"
}
source scrolledwidgetPatch.itk			;# adds ttk::scrollbar widgets
package require scrollutil
source styleUtil.tcl

wm title . "European Capitals Quiz"

set bg [ttk::style lookup TFrame -background]
if {$ttk::currentTheme eq "aqua" &&
    [package vcompare $tk_patchLevel "8.6.10"] < 0} {
................................................................................

foreach country $countryList capital $capitalList {
    set capitalArr($country) $capital
}

set capitalList [lsort $capitalList]

if {$ttk::currentTheme in {aqua vista xpnative}} {
    set topPadY 2
} else {
    set topPadY 5
}
set padY [list $topPadY 0]

set row 0







<





|







 







|







3
4
5
6
7
8
9

10
11
12
13
14
15
16
17
18
19
20
21
22
..
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#==============================================================================
# Demonstrates the use of the Scrollutil package in connection with the
# iwidgets::scrolledframe widget.
#
# Copyright (c) 2019-2020  Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
#==============================================================================


if {[catch {package require iwidgets} result1] != 0 &&
    [catch {package require Iwidgets} result2] != 0} {
    error "$result1; $result2"
}
source scrolledwidgetPatch.itk			;# adds ttk::scrollbar widgets
package require scrollutil_tile
source styleUtil.tcl

wm title . "European Capitals Quiz"

set bg [ttk::style lookup TFrame -background]
if {$ttk::currentTheme eq "aqua" &&
    [package vcompare $tk_patchLevel "8.6.10"] < 0} {
................................................................................

foreach country $countryList capital $capitalList {
    set capitalArr($country) $capital
}

set capitalList [lsort $capitalList]

if {[lsearch -exact {aqua vista xpnative} $ttk::currentTheme] >= 0} {
    set topPadY 2
} else {
    set topPadY 5
}
set padY [list $topPadY 0]

set row 0

Changes to examples/scrollutil/ScrolledTablelist1.tcl.

3
4
5
6
7
8
9

10
11
12
13
14
15
16
..
78
79
80
81
82
83
84
85
86
#==============================================================================
# Demonstrates the traditional scrollbar management in connection with a
# tablelist widget.
#
# Copyright (c) 2019-2020  Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
#==============================================================================


package require tablelist_tile 6.3
source styleUtil.tcl

wm title . "Scrolled Tablelist"

#
# Create the tablelist and the scrollbars as children
................................................................................
set b [ttk::button $f.b -text "Close" -command exit]
pack $b -side bottom -pady {0 10}

#
# Manage the frame
#
pack $frm -expand yes -fill both -padx 10 -pady 10

pack $f -expand yes -fill both







>







 







<
|
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
..
79
80
81
82
83
84
85

86
#==============================================================================
# Demonstrates the traditional scrollbar management in connection with a
# tablelist widget.
#
# Copyright (c) 2019-2020  Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
#==============================================================================

package require Tk 8.5
package require tablelist_tile 6.3
source styleUtil.tcl

wm title . "Scrolled Tablelist"

#
# Create the tablelist and the scrollbars as children
................................................................................
set b [ttk::button $f.b -text "Close" -command exit]
pack $b -side bottom -pady {0 10}

#
# Manage the frame
#
pack $frm -expand yes -fill both -padx 10 -pady 10

pack $f   -expand yes -fill both

Changes to examples/scrollutil/ScrolledTablelist2.tcl.

3
4
5
6
7
8
9

10
11
12
13
14
15
16
..
59
60
61
62
63
64
65
66
67
#==============================================================================
# Demonstrates the use of the scrollutil::scrollarea widget in connection with
# a tablelist.
#
# Copyright (c) 2019-2020  Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
#==============================================================================


package require tablelist_tile 6.5
package require scrollutil_tile
source styleUtil.tcl

wm title . "Scrolled Tablelist"

#
................................................................................
set b [ttk::button $f.b -text "Close" -command exit]
pack $b -side bottom -pady {0 10}

#
# Manage the scrollarea
#
pack $sa -expand yes -fill both -padx 10 -pady 10

pack $f -expand yes -fill both







>







 







<
|
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
..
60
61
62
63
64
65
66

67
#==============================================================================
# Demonstrates the use of the scrollutil::scrollarea widget in connection with
# a tablelist.
#
# Copyright (c) 2019-2020  Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
#==============================================================================

package require Tk 8.5
package require tablelist_tile 6.5
package require scrollutil_tile
source styleUtil.tcl

wm title . "Scrolled Tablelist"

#
................................................................................
set b [ttk::button $f.b -text "Close" -command exit]
pack $b -side bottom -pady {0 10}

#
# Manage the scrollarea
#
pack $sa -expand yes -fill both -padx 10 -pady 10

pack $f  -expand yes -fill both

Added examples/scrollutil/ScrolledText.tcl.









































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#!/usr/bin/env wish

#==============================================================================
# Demonstrates the use of the scrollutil::scrollarea widget in connection with
# a text widget.
#
# Copyright (c) 2020  Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
#==============================================================================

package require scrollutil_tile
source styleUtil.tcl

wm title . "Scrolled Text"

#
# Create a text widget within a scrollarea
#
set f  [ttk::frame .f]
set sa [scrollutil::scrollarea $f.sa -lockinterval 10]
set txt [text $sa.txt -font TkFixedFont -width 49 -height 12 \
	 -spacing1 2 -spacing3 2 -wrap none]
$sa setwidget $txt

#
# Populate the text widget and set the background color of line #25 to red
#
for {set i 1} {$i <= 30} {incr i} {
    set j [expr {2*$i}]
    $txt insert end [string repeat X $j]\n
}
$txt delete 30.end
$txt tag configure bgRed -background red
$txt tag add bgRed 25.0 25.end

#
# Create a ttk::button widget outside the scrollarea
#
set b [ttk::button $f.b -text "Close" -command exit]
pack $b -side bottom -pady {0 10}

#
# Manage the scrollarea
#
pack $sa -expand yes -fill both -padx 10 -pady 10
pack $f  -expand yes -fill both

#
# Adjust the vertical view in the text window
# so that line #25 becomes the bottom line
#
tkwait visibility $txt
after 100 [list $txt yview 14.0]

Changes to examples/scrollutil/SuScrollableFrmDemo1.tcl.

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
..
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#==============================================================================
# Demonstrates the use of the Scrollutil package in connection with the
# scrollutil::scrollableframe widget.
#
# Copyright (c) 2019-2020  Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
#==============================================================================

package require Tk 8.5
package require scrollutil_tile
source styleUtil.tcl

wm title . "European Capitals Quiz"

#
# Create a scrollableframe within a scrollarea
................................................................................

foreach country $countryList capital $capitalList {
    set capitalArr($country) $capital
}

set capitalList [lsort $capitalList]

if {$ttk::currentTheme in {aqua vista xpnative}} {
    set topPadY 2
} else {
    set topPadY 5
}
set padY [list $topPadY 0]

set row 0







<







 







|







3
4
5
6
7
8
9

10
11
12
13
14
15
16
..
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#==============================================================================
# Demonstrates the use of the Scrollutil package in connection with the
# scrollutil::scrollableframe widget.
#
# Copyright (c) 2019-2020  Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
#==============================================================================


package require scrollutil_tile
source styleUtil.tcl

wm title . "European Capitals Quiz"

#
# Create a scrollableframe within a scrollarea
................................................................................

foreach country $countryList capital $capitalList {
    set capitalArr($country) $capital
}

set capitalList [lsort $capitalList]

if {[lsearch -exact {aqua vista xpnative} $ttk::currentTheme] >= 0} {
    set topPadY 2
} else {
    set topPadY 5
}
set padY [list $topPadY 0]

set row 0

Changes to examples/scrollutil/SyncListboxes.tcl.

16
17
18
19
20
21
22
23

24
25
26
27
28
29
30
..
64
65
66
67
68
69
70
71
72

73
74
75
76
77
78
79
# Create two ttk::label widgets within a ttk::frame
#
set f  [ttk::frame .f]
set tf [ttk::frame $f.tf]
set l1 [ttk::label $tf.l1 -text "Countries"]
set l2 [ttk::label $tf.l2 -text "Capitals"]
grid $l1 $l2
grid columnconfigure $tf all -weight 1 -uniform AllCols


#
# Create a scrollsync widget within a scrollarea
#
set sa [scrollutil::scrollarea $f.sa]
set ss [scrollutil::scrollsync $sa.ss]
$sa setwidget $ss
................................................................................
set itemCount [$lb1 size]
for {set idx 1} {$idx < $itemCount} {incr idx 2} {
    $lb1 itemconfigure $idx -background #f0f0f0
    $lb2 itemconfigure $idx -background #f0f0f0
}

grid $lb1 $lb2 -sticky news -padx {0 2}
grid rowconfigure    $ss 0   -weight 1
grid columnconfigure $ss all -weight 1


#
# Create a ttk::button widget
#
set b [ttk::button $f.b -text "Close" -command exit]

pack $b  -side bottom -pady {0 10}







|
>







 







|
|
>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
..
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Create two ttk::label widgets within a ttk::frame
#
set f  [ttk::frame .f]
set tf [ttk::frame $f.tf]
set l1 [ttk::label $tf.l1 -text "Countries"]
set l2 [ttk::label $tf.l2 -text "Capitals"]
grid $l1 $l2
grid columnconfigure $tf 0 -weight 1 -uniform AllCols
grid columnconfigure $tf 1 -weight 1 -uniform AllCols

#
# Create a scrollsync widget within a scrollarea
#
set sa [scrollutil::scrollarea $f.sa]
set ss [scrollutil::scrollsync $sa.ss]
$sa setwidget $ss
................................................................................
set itemCount [$lb1 size]
for {set idx 1} {$idx < $itemCount} {incr idx 2} {
    $lb1 itemconfigure $idx -background #f0f0f0
    $lb2 itemconfigure $idx -background #f0f0f0
}

grid $lb1 $lb2 -sticky news -padx {0 2}
grid rowconfigure    $ss 0 -weight 1
grid columnconfigure $ss 0 -weight 1
grid columnconfigure $ss 1 -weight 1

#
# Create a ttk::button widget
#
set b [ttk::button $f.b -text "Close" -command exit]

pack $b  -side bottom -pady {0 10}

Changes to examples/scrollutil/SyncTablelists.tcl.

18
19
20
21
22
23
24
25


26
27
28
29
30
31
32
..
45
46
47
48
49
50
51
52
53


54
55
56
57
58
59
60
#
set f  [ttk::frame .f]
set tf [ttk::frame $f.tf]
set l1 [ttk::label $tf.l1 -text "Left Table"]
set l2 [ttk::label $tf.l2 -text "Middle Table"]
set l3 [ttk::label $tf.l3 -text "Right Table"]
grid $l1 $l2 $l3
grid columnconfigure $tf all -weight 1 -uniform AllCols



#
# Create a scrollsync widget within a scrollarea
#
set sa [scrollutil::scrollarea $f.sa]
set ss [scrollutil::scrollsync $sa.ss]
$sa setwidget $ss
................................................................................
    for {set i 0} {$i < 100} {incr i} {
	$tbl insert end [list "cell $i,0" "cell $i,1"]
    }
}
$ss setwidgets [list $tbl1 $tbl2 $tbl3]

grid $tbl1 $tbl2 $tbl3 -sticky news -padx {0 2}
grid rowconfigure    $ss 0   -weight 1
grid columnconfigure $ss all -weight 1



#
# Create a ttk::button widget
#
set b [ttk::button $f.b -text "Close" -command exit]

pack $b  -side bottom -pady {0 10}







|
>
>







 







|
|
>
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
..
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#
set f  [ttk::frame .f]
set tf [ttk::frame $f.tf]
set l1 [ttk::label $tf.l1 -text "Left Table"]
set l2 [ttk::label $tf.l2 -text "Middle Table"]
set l3 [ttk::label $tf.l3 -text "Right Table"]
grid $l1 $l2 $l3
grid columnconfigure $tf 0 -weight 1 -uniform AllCols
grid columnconfigure $tf 1 -weight 1 -uniform AllCols
grid columnconfigure $tf 2 -weight 1 -uniform AllCols

#
# Create a scrollsync widget within a scrollarea
#
set sa [scrollutil::scrollarea $f.sa]
set ss [scrollutil::scrollsync $sa.ss]
$sa setwidget $ss
................................................................................
    for {set i 0} {$i < 100} {incr i} {
	$tbl insert end [list "cell $i,0" "cell $i,1"]
    }
}
$ss setwidgets [list $tbl1 $tbl2 $tbl3]

grid $tbl1 $tbl2 $tbl3 -sticky news -padx {0 2}
grid rowconfigure    $ss 0 -weight 1
grid columnconfigure $ss 0 -weight 1
grid columnconfigure $ss 1 -weight 1
grid columnconfigure $ss 2 -weight 1

#
# Create a ttk::button widget
#
set b [ttk::button $f.b -text "Close" -command exit]

pack $b  -side bottom -pady {0 10}

Changes to examples/scrollutil/styleUtil.tcl.

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
..
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
}

#
# TCombobox
#
# Make sure the combobox will show whether it has the focus
#
if {$ttk::currentTheme in {alt clam default}} {
    ttk::style map TCombobox \
	-fieldbackground [list {readonly focus} #4a6984] \
	-foreground      [list {readonly focus} #ffffff]

    option add *TCombobox*Listbox.selectBackground  #4a6984
    option add *TCombobox*Listbox.selectForeground  #ffffff
}
................................................................................

#
# createToolbutton
#
# Creates a toolbutton widget which appears raised when it has the focus.
#
proc createToolbutton {w args} {
    ttk::button $w -style Small.Toolbutton {*}$args

    if {$ttk::currentTheme in {vista xpnative}} {
	bindtags $w [linsert [bindtags $w] 1 Toolbtn]
    }

    return $w
}

#
# "Toolbtn" bindings for the themes "vista" and "xpnative"
#
bind Toolbtn <FocusIn>		{ %W state  active }
bind Toolbtn <FocusOut>		{ %W state !active }
bind Toolbtn <Leave>		{ %W instate focus break }
bind Toolbtn <Button1-Leave>	{ %W state !pressed }







|







 







|

|













28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
..
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
}

#
# TCombobox
#
# Make sure the combobox will show whether it has the focus
#
if {[lsearch -exact {alt clam default} $ttk::currentTheme] >= 0} {
    ttk::style map TCombobox \
	-fieldbackground [list {readonly focus} #4a6984] \
	-foreground      [list {readonly focus} #ffffff]

    option add *TCombobox*Listbox.selectBackground  #4a6984
    option add *TCombobox*Listbox.selectForeground  #ffffff
}
................................................................................

#
# createToolbutton
#
# Creates a toolbutton widget which appears raised when it has the focus.
#
proc createToolbutton {w args} {
    eval ttk::button $w -style Small.Toolbutton $args

    if {[lsearch -exact {vista xpnative} $ttk::currentTheme] >= 0} {
	bindtags $w [linsert [bindtags $w] 1 Toolbtn]
    }

    return $w
}

#
# "Toolbtn" bindings for the themes "vista" and "xpnative"
#
bind Toolbtn <FocusIn>		{ %W state  active }
bind Toolbtn <FocusOut>		{ %W state !active }
bind Toolbtn <Leave>		{ %W instate focus break }
bind Toolbtn <Button1-Leave>	{ %W state !pressed }

Changes to modules/scrollutil/CHANGES.txt.

1
2
















3
4
5
6
7
8
9
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
|

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







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
What is new in Scrollutil 1.5?
------------------------------

1. On Windows and X11, Scrollutil now automatically creates mouse wheel
   event class bindings for the Tk core scrollbar widget, which are
   missing on these platforms when using a Tk version earlier than 8.6.

2. Added a demo script showing how the scrollarea widget circumvents the
   potential shimmering effect in connection with text widgets.

3. Improved the handling of the case that the scrollbar lock prevented a
   scrollbar of a scrollarea widget from being unmapped (thanks to Paul
   Obermeier for his bug report).

4. Several improvements in the demo scripts and documentation.

What was 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

Changes to modules/scrollutil/COPYRIGHT.txt.

1
2
3
4
5
6
7
8
9
10
Scrolling utilities package Scrollutil 1.4
Copyright (c) 2019-2020  Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)

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
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|









1
2
3
4
5
6
7
8
9
10
Scrolling utilities package Scrollutil 1.5
Copyright (c) 2019-2020  Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)

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
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Changes to modules/scrollutil/ChangeLog.































1
2
3
4
5
6
7






























2020-01-10  Csaba Nemethi <csaba.nemethi@t-online.de>

	* README.txt: Updated the version number.

2020-01-07  Csaba Nemethi <csaba.nemethi@t-online.de>

	* *.tcl:         Bumped the version number to 1.4; updated the copyright
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
2020-02-06  Csaba Nemethi <csaba.nemethi@t-online.de>

	* doc/scrollutil.html: Minor improvements.

2020-02-05  Csaba Nemethi <csaba.nemethi@t-online.de>

	* *.tcl:         Bumped the version number to 1.5.
	* COPYRIGHT.txt:
	* README.txt:

	* CHANGES.txt: Updated to reflect the changes.

	* scripts/scrollarea.tcl: Improved the handling of the case that the
	  scrollbar lock prevented a scrollbar of a scrollarea widget from
	  being unmapped.

	* scripts/wheelEvent.tcl: Creating mouse wheel event class bindings for
	  the Tk core scrollbar widget on Windows and X11, which are missing on
	  these platforms when using a Tk version earlier than 8.6.

	* scripts/tclIndex: Newly generated.

	* doc/*.html: Updated to reflect the changes; several improvements.

	* doc/ScrolledText.png: Added.

	* ../../examples/scrollutil/*.tcl: Several improvements.

	* ../../examples/scrollutil/ScrolledText.tcl: Added.

2020-01-10  Csaba Nemethi <csaba.nemethi@t-online.de>

	* README.txt: Updated the version number.

2020-01-07  Csaba Nemethi <csaba.nemethi@t-online.de>

	* *.tcl:         Bumped the version number to 1.4; updated the copyright

Changes to modules/scrollutil/README.txt.

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
..
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
How to Get It?
--------------

Scrollutil is available for free download from the Web page

    https://www.nemethi.de

The distribution file is "scrollutil1.4.tar.gz" for UNIX and
"scrollutil1_4.zip" 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.

Scrollutil is also included in tklib, which has the address

    https://core.tcl.tk/tklib
................................................................................
Install the package as a subdirectory of one of the directories given
by the "auto_path" variable.  For example, you can install it as a
directory at the same level as the Tcl and Tk script libraries.  The
locations of these library directories are given by the "tcl_library"
and "tk_library" variables, respectively.

To install Scrollutil on UNIX, "cd" to the desired directory and unpack
the distribution file "scrollutil1.4.tar.gz":

    gunzip -c scrollutil1.4.tar.gz | tar -xf -

On most UNIX systems this can be replaced with

    tar -zxf scrollutil1.4.tar.gz

Both commands will create a directory named "scrollutil1.4", with the
subdirectories "demos", "doc", and "scripts".

On Windows, use WinZip or some other program capable of unpacking the
distribution file "scrollutil1_4.zip" into the directory
"scrollutil1.4", with the subdirectories "demos", "doc", and "scripts".

How to Use It?
--------------

The Scrollutil distribution provides two packages, called Scrollutil and
Scrollutil_tile.  The main difference between the two is that
Scrollutil_tile enables the tile-based, theme-specific appearance of







|
|







 







|

|



|

|



|
|







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
..
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
How to Get It?
--------------

Scrollutil is available for free download from the Web page

    https://www.nemethi.de

The distribution file is "scrollutil1.5.tar.gz" for UNIX and
"scrollutil1_5.zip" 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.

Scrollutil is also included in tklib, which has the address

    https://core.tcl.tk/tklib
................................................................................
Install the package as a subdirectory of one of the directories given
by the "auto_path" variable.  For example, you can install it as a
directory at the same level as the Tcl and Tk script libraries.  The
locations of these library directories are given by the "tcl_library"
and "tk_library" variables, respectively.

To install Scrollutil on UNIX, "cd" to the desired directory and unpack
the distribution file "scrollutil1.5.tar.gz":

    gunzip -c scrollutil1.5.tar.gz | tar -xf -

On most UNIX systems this can be replaced with

    tar -zxf scrollutil1.5.tar.gz

Both commands will create a directory named "scrollutil1.5", with the
subdirectories "demos", "doc", and "scripts".

On Windows, use WinZip or some other program capable of unpacking the
distribution file "scrollutil1_5.zip" into the directory
"scrollutil1.5", with the subdirectories "demos", "doc", and "scripts".

How to Use It?
--------------

The Scrollutil distribution provides two packages, called Scrollutil and
Scrollutil_tile.  The main difference between the two is that
Scrollutil_tile enables the tile-based, theme-specific appearance of

Added modules/scrollutil/doc/ScrolledText.png.

cannot compute difference between binary files

Changes to modules/scrollutil/doc/index.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!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:csaba.nemethi@t-online.de">csaba.nemethi@t-online.de</a>



|










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html>
<html>
<head>
  <title>The Scrolling Utilities Package Scrollutil 1.5</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.5</h1>

    <h3>by</h3>

    <h2>Csaba Nemethi</h2>

    <address>
      <a href="mailto:csaba.nemethi@t-online.de">csaba.nemethi@t-online.de</a>

Changes to modules/scrollutil/doc/scrollableframe.html.

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:csaba.nemethi@t-online.de">csaba.nemethi@t-online.de</a>







|







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.5</h2>

    <h3>by</h3>

    <h2>Csaba Nemethi</h2>

    <address>
      <a href="mailto:csaba.nemethi@t-online.de">csaba.nemethi@t-online.de</a>

Changes to modules/scrollutil/doc/scrollarea.html.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</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:csaba.nemethi@t-online.de">csaba.nemethi@t-online.de</a>







|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</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.5</h2>

    <h3>by</h3>

    <h2>Csaba Nemethi</h2>

    <address>
      <a href="mailto:csaba.nemethi@t-online.de">csaba.nemethi@t-online.de</a>

Changes to modules/scrollutil/doc/scrollsync.html.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</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:csaba.nemethi@t-online.de">csaba.nemethi@t-online.de</a>







|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</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.5</h2>

    <h3>by</h3>

    <h2>Csaba Nemethi</h2>

    <address>
      <a href="mailto:csaba.nemethi@t-online.de">csaba.nemethi@t-online.de</a>

Changes to modules/scrollutil/doc/scrollutil.html.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
44
45
46
47
48
49
50


51
52
53
54
55
56
57
...
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
...
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
...
460
461
462
463
464
465
466

467
468
469
470
471
472
473
...
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
...
520
521
522
523
524
525
526

527
528
529
530
531
532
533
...
542
543
544
545
546
547
548



549








































550













551
552






























553
554
555
556
557
558
559
...
594
595
596
597
598
599
600
601
602

603
604
605
606

607
608
609
610
611
612
613
...
659
660
661
662
663
664
665
666
667


668
669
670
671

672
673
674
675
676
677
678
...
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
...
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
...
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
  <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:csaba.nemethi@t-online.de">csaba.nemethi@t-online.de</a>
................................................................................
  <h4><a href="#examples">Examples</a></h4>

  <ul>
    <li><a href="#ex_styleUtil">The Helper Script
    <code>styleUtil.tcl</code></a></li>

    <li><a href="#ex_ScrolledTablelist">A Scrolled tablelist Widget</a></li>



    <li><a href="#ex_SyncListboxes">Synchronizing Two listbox Widgets</a></li>

    <li><a href="#ex_SyncTablelists">Synchronizing Three tablelist
    Widgets</a></li>

    <li><a href="#ex_SuScrollableFrameDemo1">A Script Using a
................................................................................

  <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.&nbsp; 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>
................................................................................
  a directory at the same level as the Tcl and Tk script libraries.&nbsp; 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.&nbsp; Please take this into account when
  reading the <a href="#examples">examples</a> below.</p>

................................................................................
  </blockquote>

  <p>The script achieves these requirements using traditional scrollbar
  management, which is shown below in <span class="red">red</span> color:</p>

  <blockquote>
    <pre>

package require tablelist_tile 6.3
source styleUtil.tcl

wm title . "Scrolled Tablelist"

<span class="cmt">#
# Create the tablelist and the scrollbars as children
................................................................................
grid rowconfigure    $frm 1 -weight 1
grid columnconfigure $frm 1 -weight 1</span>

<span class="cmt">#
# Manage the frame
#</span>
pack $frm -expand yes -fill both -padx 10 -pady 10

. . .
</pre>
  </blockquote>

  <p>The file <code>ScrolledTablelist2.tcl</code> in the <code>demos</code>
  directory replaces the rather technical code above with just a few lines
  (shown below in <span class="red">red</span> color), by embedding the
  tablelist into a scrollarea widget.&nbsp; It requires Tablelist version 6.5,
................................................................................
  scrollarea options can work as expected (for earlier Tablelist versions these
  options are silently ignored).&nbsp; As a further benefit, the scrollbars
  created with this method will have the default display mode
  <code>dynamic</code>.</p>

  <blockquote>
    <pre>

package require tablelist_tile 6.5
<span class="red">package require scrollutil_tile</span>
source styleUtil.tcl

wm title . "Scrolled Tablelist"

<span class="cmt">#
................................................................................

. . .

<span class="cmt">#
# Manage the scrollarea
#</span>
pack $sa -expand yes -fill both -padx 10 -pady 10












































. . .













</pre>
  </blockquote>































  <h3 id="ex_SyncListboxes">Synchronizing Two listbox Widgets</h3>

  <p>The file <code>SyncListboxes.tcl</code> in the <code>demos</code>
  directory creates two listboxes within a <a href=
  "scrollsync.html">scrollsync</a> widget, which in turn is embedded into a
  <a href="scrollarea.html">scrollarea</a>.</p>
................................................................................
set lb1 [listbox $ss.lb1 -activestyle none -highlightthickness 0 -width 16]
set lb2 [listbox $ss.lb2 -activestyle none -highlightthickness 0 -width 16]
<span class="red">$ss setwidgets [list $lb1 $lb2]</span>

. . .

grid $lb1 $lb2 -sticky news -padx {0 2}
grid rowconfigure    $ss 0   -weight 1
grid columnconfigure $ss all -weight 1


. . .

pack $sa -side top -expand yes -fill both -padx 10 -pady {2 10}


. . .
</pre>
  </blockquote>

  <h3 id="ex_SyncTablelists">Synchronizing Three tablelist Widgets</h3>

................................................................................
    for {set i 0} {$i < 40} {incr i} {
        $tbl insert end [list "cell $i,0" "cell $i,1"]
    }
}
<span class="red">$ss setwidgets [list $tbl1 $tbl2 $tbl3]</span>

grid $tbl1 $tbl2 $tbl3 -sticky news -padx {0 2}
grid rowconfigure    $ss 0   -weight 1
grid columnconfigure $ss all -weight 1



. . .

pack $sa -side top -expand yes -fill both -padx 10 -pady {2 10}


. . .
</pre>
  </blockquote>

  <p>Notice that column #1 of the three tablelist widgets is 40, 60, and 80
  characters wide, respectively.&nbsp; For this reason, when scrolling
................................................................................
    height="373">
  </blockquote>

  <p>Here is the relevant code:</p>

  <blockquote>
    <pre>
package require Tk 8.5
<span class="red">package require scrollutil_tile</span>
source styleUtil.tcl

wm title . "European Capitals Quiz"

<span class="cmt">#
# Create a scrollableframe within a scrollarea
................................................................................
  <code>SuScrollableFrmDemo1.tcl</code> in the <a href=
  "#ex_SuScrollableFrameDemo1">previous example</a>.</p>

  <p>Here is the relevant code:</p>

  <blockquote>
    <pre>
package require Tk 8.5
package require BWidget
Widget::theme yes
<span class="red">package require scrollutil_tile</span>
source styleUtil.tcl

wm title . "European Capitals Quiz"

................................................................................
  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 &&
    [catch {package require Iwidgets} result2] != 0} {
    error "$result1; $result2"
}
source scrolledwidgetPatch.itk                  ;<span class="cmt"># adds ttk::scrollbar widgets</span>
<span class="red">package require scrollutil</span>
source styleUtil.tcl

wm title . "European Capitals Quiz"

. . .

<span class="cmt">#







|







 







>
>







 







|
|







 







|



|







|



|




|
|







 







>







 







|
<







 







>







 







>
>
>

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

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


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







 







|
|
>




>







 







|
|
>
>




>







 







<







 







<







 







<





|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
...
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
...
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
304
305
...
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
...
504
505
506
507
508
509
510
511

512
513
514
515
516
517
518
...
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
...
545
546
547
548
549
550
551
552
553
554
555
556
557
558
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
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
...
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
...
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
...
799
800
801
802
803
804
805

806
807
808
809
810
811
812
...
906
907
908
909
910
911
912

913
914
915
916
917
918
919
...
997
998
999
1000
1001
1002
1003

1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
  <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.5</h2>

    <h3>by</h3>

    <h2>Csaba Nemethi</h2>

    <address>
      <a href="mailto:csaba.nemethi@t-online.de">csaba.nemethi@t-online.de</a>
................................................................................
  <h4><a href="#examples">Examples</a></h4>

  <ul>
    <li><a href="#ex_styleUtil">The Helper Script
    <code>styleUtil.tcl</code></a></li>

    <li><a href="#ex_ScrolledTablelist">A Scrolled tablelist Widget</a></li>

    <li><a href="#ex_ScrolledText">A Scrolled text Widget</a></li>

    <li><a href="#ex_SyncListboxes">Synchronizing Two listbox Widgets</a></li>

    <li><a href="#ex_SyncTablelists">Synchronizing Three tablelist
    Widgets</a></li>

    <li><a href="#ex_SuScrollableFrameDemo1">A Script Using a
................................................................................

  <blockquote>
    <address>
      <a href="https://www.nemethi.de">https://www.nemethi.de</a>
    </address>
  </blockquote>

  <p>The distribution file is <code>scrollutil1.5.tar.gz</code> for UNIX and
  <code>scrollutil1_5.zip</code> for Windows.&nbsp; 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>
................................................................................
  a directory at the same level as the Tcl and Tk script libraries.&nbsp; 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.5.tar.gz</code>:</p>

  <blockquote>
    <pre>
gunzip -c scrollutil1.5.tar.gz | tar -xf -
</pre>
  </blockquote>

  <p>On most UNIX systems this can be replaced with</p>

  <blockquote>
    <pre>
tar -zxf scrollutil1.5.tar.gz
</pre>
  </blockquote>

  <p>Both commands will create a directory named <code>scrollutil1.5</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_5.zip</code> into the directory
  <code>scrollutil1.5</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.&nbsp; Please take this into account when
  reading the <a href="#examples">examples</a> below.</p>

................................................................................
  </blockquote>

  <p>The script achieves these requirements using traditional scrollbar
  management, which is shown below in <span class="red">red</span> color:</p>

  <blockquote>
    <pre>
package require Tk 8.5
package require tablelist_tile 6.3
source styleUtil.tcl

wm title . "Scrolled Tablelist"

<span class="cmt">#
# Create the tablelist and the scrollbars as children
................................................................................
grid rowconfigure    $frm 1 -weight 1
grid columnconfigure $frm 1 -weight 1</span>

<span class="cmt">#
# Manage the frame
#</span>
pack $frm -expand yes -fill both -padx 10 -pady 10
pack $f   -expand yes -fill both

</pre>
  </blockquote>

  <p>The file <code>ScrolledTablelist2.tcl</code> in the <code>demos</code>
  directory replaces the rather technical code above with just a few lines
  (shown below in <span class="red">red</span> color), by embedding the
  tablelist into a scrollarea widget.&nbsp; It requires Tablelist version 6.5,
................................................................................
  scrollarea options can work as expected (for earlier Tablelist versions these
  options are silently ignored).&nbsp; As a further benefit, the scrollbars
  created with this method will have the default display mode
  <code>dynamic</code>.</p>

  <blockquote>
    <pre>
package require Tk 8.5
package require tablelist_tile 6.5
<span class="red">package require scrollutil_tile</span>
source styleUtil.tcl

wm title . "Scrolled Tablelist"

<span class="cmt">#
................................................................................

. . .

<span class="cmt">#
# Manage the scrollarea
#</span>
pack $sa -expand yes -fill both -padx 10 -pady 10
pack $f  -expand yes -fill both
</pre>
  </blockquote>

  <h3 id="ex_ScrolledText">A Scrolled text Widget</h3>

  <p>The file <code>ScrolledText.tcl</code> in the <code>demos</code> directory
  shows how the <a href="scrollarea.html">scrollarea</a> widget circumvents the
  potential shimmering effect in connection with text widgets.</p>

  <blockquote>
    <img src="ScrolledText.png" alt="ScrolledText" width="401" height="338">
  </blockquote>

  <p>Here is the relevant code, in which the lines related to the scrollarea
  widget are shown in <span class="red">red</span> color:</p>

  <blockquote>
    <pre>
<span class="red">package require scrollutil_tile</span>
source styleUtil.tcl

wm title . "Scrolled Text"

<span class="cmt">#
# Create a text widget within a scrollarea
#</span>
set f  [ttk::frame .f]
<span class="red">set sa [scrollutil::scrollarea $f.sa -lockinterval 10]</span>
set txt [text $sa.txt -font TkFixedFont -width 49 -height 12 \
         -spacing1 2 -spacing3 2 -wrap none]
<span class="red">$sa setwidget $txt</span>

<span class="cmt">#
# Populate the text widget and set the background color of line #25 to red
#</span>
for {set i 1} {$i <= 30} {incr i} {
    set j [expr {2*$i}]
    $txt insert end [string repeat x $j]\n
}
$txt delete 30.end
$txt tag configure bgRed -background red
$txt tag add bgRed 25.0 25.end

. . .

<span class="cmt">#
# Manage the scrollarea
#</span>
pack $sa -expand yes -fill both -padx 10 -pady 10
pack $f  -expand yes -fill both

<span class="cmt">#
# Adjust the vertical view in the text window
# so that line #25 becomes the bottom line
#</span>
tkwait visibility $txt
after 100 [list $txt yview 14.0]
</pre>
  </blockquote>

  <p>The script creates a text widget <code>$txt</code> embedded into a
  scrollarea, populates it with 30 lines, and adjusts the vertical view in the
  text window so that line #25 becomes the bottom line.&nbsp; This line has 50
  characters, hence it doesn't fit completely into the window, whose width is
  49 characters.&nbsp; Consequently, the command&nbsp; <code>$txt
  xview</code>&nbsp; will return the list&nbsp; <code>{0.0 0.98}</code>,&nbsp;
  hence the scrollarea's horizontal scrollbar will be mapped and will obscure
  most part of the bottom line.&nbsp; Since this line has <code>red</code>
  background, it is easy to see how much of it sticks out above the upper edge
  of the scrollbar.</p>

  <p>Let's analyze what happens if the text widget's height is decreased by
  dragging the main window's upper or lower edge, just until the red pixels get
  obscured by the horizontal scrollbar.&nbsp; After performing this action,
  line #25 is completely out of view and the new bottom line is line #24, which
  has 48 characters, hence the command&nbsp; <code>$txt xview</code>&nbsp; will
  return&nbsp; <code>{0.0 1.0}</code>.&nbsp; Normally, this would cause the
  horizontal scrollbar to be unmapped.&nbsp; However, that would make line #25
  to the bottom line, thus causing the horizontal scrollbar to be mapped
  again.&nbsp; This time the scrollbar would completely obscure this line,
  which would result in line #24 to become the bottom line, which would cause
  the scrollbar to be unmapped again, and so on.&nbsp; In other words, the
  horizontal scrollbar would get mapped and unmapped in an endless loop, giving
  rise to an annoying flickering effect.&nbsp; The built-in locking mechanism
  of the scrollarea widget guards against such potential endless loops.&nbsp;
  To make sure that the locking will work as expected, we have set the
  <code><a href="scrollarea.html#lockinterval">-lockinterval</a></code>
  scrollarea option to <code>10</code> (recall that the default value is
  <code>1</code>).</p>

  <h3 id="ex_SyncListboxes">Synchronizing Two listbox Widgets</h3>

  <p>The file <code>SyncListboxes.tcl</code> in the <code>demos</code>
  directory creates two listboxes within a <a href=
  "scrollsync.html">scrollsync</a> widget, which in turn is embedded into a
  <a href="scrollarea.html">scrollarea</a>.</p>
................................................................................
set lb1 [listbox $ss.lb1 -activestyle none -highlightthickness 0 -width 16]
set lb2 [listbox $ss.lb2 -activestyle none -highlightthickness 0 -width 16]
<span class="red">$ss setwidgets [list $lb1 $lb2]</span>

. . .

grid $lb1 $lb2 -sticky news -padx {0 2}
grid rowconfigure    $ss 0 -weight 1
grid columnconfigure $ss 0 -weight 1
grid columnconfigure $ss 1 -weight 1

. . .

pack $sa -side top -expand yes -fill both -padx 10 -pady {2 10}
pack $f  -expand yes -fill both

. . .
</pre>
  </blockquote>

  <h3 id="ex_SyncTablelists">Synchronizing Three tablelist Widgets</h3>

................................................................................
    for {set i 0} {$i < 40} {incr i} {
        $tbl insert end [list "cell $i,0" "cell $i,1"]
    }
}
<span class="red">$ss setwidgets [list $tbl1 $tbl2 $tbl3]</span>

grid $tbl1 $tbl2 $tbl3 -sticky news -padx {0 2}
grid rowconfigure    $ss 0 -weight 1
grid columnconfigure $ss 0 -weight 1
grid columnconfigure $ss 1 -weight 1
grid columnconfigure $ss 2 -weight 1

. . .

pack $sa -side top -expand yes -fill both -padx 10 -pady {2 10}
pack $f  -expand yes -fill both

. . .
</pre>
  </blockquote>

  <p>Notice that column #1 of the three tablelist widgets is 40, 60, and 80
  characters wide, respectively.&nbsp; For this reason, when scrolling
................................................................................
    height="373">
  </blockquote>

  <p>Here is the relevant code:</p>

  <blockquote>
    <pre>

<span class="red">package require scrollutil_tile</span>
source styleUtil.tcl

wm title . "European Capitals Quiz"

<span class="cmt">#
# Create a scrollableframe within a scrollarea
................................................................................
  <code>SuScrollableFrmDemo1.tcl</code> in the <a href=
  "#ex_SuScrollableFrameDemo1">previous example</a>.</p>

  <p>Here is the relevant code:</p>

  <blockquote>
    <pre>

package require BWidget
Widget::theme yes
<span class="red">package require scrollutil_tile</span>
source styleUtil.tcl

wm title . "European Capitals Quiz"

................................................................................
  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>

if {[catch {package require iwidgets} result1] != 0 &&
    [catch {package require Iwidgets} result2] != 0} {
    error "$result1; $result2"
}
source scrolledwidgetPatch.itk                  ;<span class="cmt"># adds ttk::scrollbar widgets</span>
<span class="red">package require scrollutil_tile</span>
source styleUtil.tcl

wm title . "European Capitals Quiz"

. . .

<span class="cmt">#

Changes to modules/scrollutil/doc/wheelEvent.html.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
68
69
70
71
72
73
74




75
76
77
78
79
80
81
82
...
158
159
160
161
162
163
164




165
166
167
168
169
170
171
172
...
214
215
216
217
218
219
220




221
222
223
224
225
226
227
228
...
255
256
257
258
259
260
261




262
263
264
265
266
267
268
269
...
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
...
418
419
420
421
422
423
424




425
426
427
428
429
430
431
432
...
532
533
534
535
536
537
538




539
540
541
542
543
544
545
546
  <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:csaba.nemethi@t-online.de">csaba.nemethi@t-online.de</a>
................................................................................

    <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).&nbsp; The binding scripts created by this command will scroll
................................................................................

    <dd>
      <pre>
<b>scrollutil::createWheelEventBindings</b> ?<i>tag</i> <i>tag</i> ...?
</pre>
    </dd>





    <dt><b>DESCRIPTION</b></dt>

    <dd>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
    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.&nbsp; In case of
................................................................................

    <dd>
      <pre>
<b>scrollutil::enableScrollingByWheel</b> ?<i>scrollableWidgetContainer</i> <i>scrollableWidgetContainer</i> ...?
</pre>
    </dd>





    <dt><b>DESCRIPTION</b></dt>

    <dd>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 <code><b><a href=
    "#create">scrollutil::createWheelEventBindings</a></b></code> command.</dd>

    <dd class="tm"><b>REMARK:</b>&nbsp; When a scrollable widget container
................................................................................

    <dd>
      <pre>
<b>scrollutil::adaptWheelEventHandling</b> ?<i>widget</i> <i>widget</i> ...?
</pre>
    </dd>





    <dt><b>DESCRIPTION</b></dt>

    <dd>For each <code><i>widget</i></code> argument, the command performs the
    following actions:</dd>

    <dd class="tm">
      <ul>
        <li>
................................................................................

    <dd class="tm"><b>REMARK 1:</b>&nbsp; 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).&nbsp; 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.&nbsp; 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>.&nbsp; 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>&nbsp; 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.&nbsp; 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>&nbsp; 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>&nbsp; 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.&nbsp; 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
................................................................................

    <dd>
      <pre>
<b>scrollutil::setFocusCheckWindow</b> <i>widget</i> ?<i>widget</i> ...? <i>otherWidget</i>
</pre>
    </dd>





    <dt><b>DESCRIPTION</b></dt>

    <dd>For each <code><i>widget</i></code> argument, the command sets the
    associated "focus check window" to <code><i>otherWidget</i></code>.&nbsp;
    This is the window to be used in the binding scripts for the tag
    <code><b><a href="#adapt">WheeleventRedir</a></b></code> instead of the
    widget when checking whether the focus is on/inside or outside that
    window.&nbsp; For each <code><i>widget</i></code> argument,
................................................................................

    <dd>
      <pre>
<b>scrollutil::focusCheckWindow</b> <i>widget</i>
</pre>
    </dd>





    <dt><b>DESCRIPTION</b></dt>

    <dd>Returns the path name of the "focus check window" associated with the
    <code><i>widget</i></code> argument.&nbsp; This is the window that is used
    in the binding scripts for the tag <code><b><a href=
    "#adapt">WheeleventRedir</a></b></code> instead of the widget when checking
    whether the focus is on/inside or outside that window.&nbsp; If the command
    <code><b><a href=







|







 







>
>
>
>
|







 







>
>
>
>
|







 







>
>
>
>
|







 







>
>
>
>
|







 







<
<
<
<
|
|
|





>
>
>
>
>
>
>
>
>
>
>
>
|










|






|







 







>
>
>
>
|







 







>
>
>
>
|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
...
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
...
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
...
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
...
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
398
399
400
401
402
403
404
405
406
407
408
...
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
...
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
  <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.5</h2>

    <h3>by</h3>

    <h2>Csaba Nemethi</h2>

    <address>
      <a href="mailto:csaba.nemethi@t-online.de">csaba.nemethi@t-online.de</a>
................................................................................

    <dd>
      <pre>
<b>scrollutil::addMouseWheelSupport</b> <i>tag</i> ?<i>axes</i>?
</pre>
    </dd>

    <dt><b>REQUIRED TK VERSION</b></dt>

    <dd>8.4 or higher.

    <dt class="tm"><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).&nbsp; The binding scripts created by this command will scroll
................................................................................

    <dd>
      <pre>
<b>scrollutil::createWheelEventBindings</b> ?<i>tag</i> <i>tag</i> ...?
</pre>
    </dd>

    <dt><b>REQUIRED TK VERSION</b></dt>

    <dd>8.4 or higher on X11 and Mac OS X; 8.6b2 or later on Windows.

    <dt class="tm"><b>DESCRIPTION</b></dt>

    <dd>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
    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.&nbsp; In case of
................................................................................

    <dd>
      <pre>
<b>scrollutil::enableScrollingByWheel</b> ?<i>scrollableWidgetContainer</i> <i>scrollableWidgetContainer</i> ...?
</pre>
    </dd>

    <dt><b>REQUIRED TK VERSION</b></dt>

    <dd>8.4 or higher on X11 and Mac OS X; 8.6b2 or later on Windows.

    <dt class="tm"><b>DESCRIPTION</b></dt>

    <dd>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 <code><b><a href=
    "#create">scrollutil::createWheelEventBindings</a></b></code> command.</dd>

    <dd class="tm"><b>REMARK:</b>&nbsp; When a scrollable widget container
................................................................................

    <dd>
      <pre>
<b>scrollutil::adaptWheelEventHandling</b> ?<i>widget</i> <i>widget</i> ...?
</pre>
    </dd>

    <dt><b>REQUIRED TK VERSION</b></dt>

    <dd>8.4 or higher on X11 and Mac OS X; 8.6b2 or later on Windows.

    <dt class="tm"><b>DESCRIPTION</b></dt>

    <dd>For each <code><i>widget</i></code> argument, the command performs the
    following actions:</dd>

    <dd class="tm">
      <ul>
        <li>
................................................................................

    <dd class="tm"><b>REMARK 1:</b>&nbsp; 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).&nbsp; 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.&nbsp; 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>&nbsp; The mouse wheel event class bindings
    for the Tk core scrollbar on Windows and X11 were added in Tk 8.6.&nbsp;
    Prior to this Tk version there were such bindings only for the windowing
    systems <code><b>classic</b></code> and <code><b>aqua</b></code> on the
    Macintosh.&nbsp; Scrollutil eliminates this discrepancy by automatically
    creating the <code><b>Scrollbar</b></code> class bindings for mouse wheel
    events on Windows and X11.&nbsp; Note also that the ttk::scrollbar widget
    has no <i>built-in</i> class bindings for 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>.</dd>

    <dd class="tm"><b>REMARK 3:</b>&nbsp; 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.&nbsp; 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 4:</b>&nbsp; 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 5:</b>&nbsp; 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.&nbsp; 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
................................................................................

    <dd>
      <pre>
<b>scrollutil::setFocusCheckWindow</b> <i>widget</i> ?<i>widget</i> ...? <i>otherWidget</i>
</pre>
    </dd>

    <dt><b>REQUIRED TK VERSION</b></dt>

    <dd>8.4 or higher on X11 and Mac OS X; 8.6b2 or later on Windows.

    <dt class="tm"><b>DESCRIPTION</b></dt>

    <dd>For each <code><i>widget</i></code> argument, the command sets the
    associated "focus check window" to <code><i>otherWidget</i></code>.&nbsp;
    This is the window to be used in the binding scripts for the tag
    <code><b><a href="#adapt">WheeleventRedir</a></b></code> instead of the
    widget when checking whether the focus is on/inside or outside that
    window.&nbsp; For each <code><i>widget</i></code> argument,
................................................................................

    <dd>
      <pre>
<b>scrollutil::focusCheckWindow</b> <i>widget</i>
</pre>
    </dd>

    <dt><b>REQUIRED TK VERSION</b></dt>

    <dd>8.4 or higher on X11 and Mac OS X; 8.6b2 or later on Windows.

    <dt class="tm"><b>DESCRIPTION</b></dt>

    <dd>Returns the path name of the "focus check window" associated with the
    <code><i>widget</i></code> argument.&nbsp; This is the window that is used
    in the binding scripts for the tag <code><b><a href=
    "#adapt">WheeleventRedir</a></b></code> instead of the widget when checking
    whether the focus is on/inside or outside that window.&nbsp; If the command
    <code><b><a href=

Changes to modules/scrollutil/pkgIndex.tcl.

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
#
# Copyright (c) 2019-2020  Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
#==============================================================================

#
# 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]]







|

|





|
|
|
|




|

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
#
# Copyright (c) 2019-2020  Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
#==============================================================================

#
# Regular packages:
#
package ifneeded scrollutil         1.5 \
	[list source [file join $dir scrollutil.tcl]]
package ifneeded scrollutil_tile    1.5 \
	[list source [file join $dir scrollutil_tile.tcl]]

#
# Aliases:
#
package ifneeded Scrollutil         1.5 \
	[list package require -exact scrollutil      1.5]
package ifneeded Scrollutil_tile    1.5 \
	[list package require -exact scrollutil_tile 1.5]

#
# Code common to all packages:
#
package ifneeded scrollutil::common 1.5 \
	[list source [file join $dir scrollutilCommon.tcl]]

Changes to modules/scrollutil/scripts/scrollarea.tcl.

662
663
664
665
666
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
695
696
697
...
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
...
812
813
814
815
816
817
818















819
820
821
822
823
824
825
...
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
...
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888


889
























proc scrollutil::sa::onDynamicHScrollbarMap hsb {
    set top [winfo toplevel $hsb]
    if {![winfo ismapped $top]} {
	return ""
    }

    foreach {first last} [$hsb get] {}
    if {$first == 0 && $last == 1} {
	return ""
    }

    set textWidgetFound 0
    set sa [winfo parent $hsb]
    set widget [::$sa widget]
    set class [winfo class $widget]
    if {[string compare $class "Text"]  == 0 ||
	[string compare $class "Ctext"] == 0} {
	set textWidgetFound 1
    } elseif {[string compare $class "Scrollsync"] == 0} {
	foreach w [::$widget widgets] {
	    set class [winfo class $w]
	    if {[string compare $class "Text"]  == 0 ||
		[string compare $class "Ctext"] == 0} {
		set textWidgetFound 1
		break
	    }
	}
    }
    if {!$textWidgetFound} {
	return ""
    }

    #
    # Guard against a potential endless loop by making sure that
    # showing the horizontal scrollbar won't make the toplevel higher
    #
................................................................................
	}
	grid $win.hsb		   -row 2 -column 0 -columnspan 2 -sticky ew
    }
    set data(hsbManaged) 1

    if {[winfo ismapped $win]} {
	set data(hsbLocked) 1
	after $data(-lockinterval) \
	    [list scrollutil::sa::unlockScrollbar $win hsb]
    }
}

#------------------------------------------------------------------------------
# scrollutil::sa::hideHScrollbar
#------------------------------------------------------------------------------
proc scrollutil::sa::hideHScrollbar win {
................................................................................
    if {[string compare $data(-xscrollbarmode) "dynamic"] == 0} {
	foreach {first last} [$win.hsb get] {}
	if {$first == 0 && $last == 1} {
	    hideHScrollbar $win
	}
    }
}
















#------------------------------------------------------------------------------
# scrollutil::sa::showVScrollbar
#------------------------------------------------------------------------------
proc scrollutil::sa::showVScrollbar {win {redisplay 0}} {
    upvar ::scrollutil::ns${win}::data data
    if {$data(vsbManaged) && !$redisplay} {
................................................................................
	}
	grid $win.vsb		   -row 0 -rowspan 2 -column 2 -sticky ns
    }
    set data(vsbManaged) 1

    if {[winfo ismapped $win]} {
	set data(vsbLocked) 1
	after $data(-lockinterval) \
	    [list scrollutil::sa::unlockScrollbar $win vsb]
    }
}

#------------------------------------------------------------------------------
# scrollutil::sa::hideVScrollbar
#------------------------------------------------------------------------------
proc scrollutil::sa::hideVScrollbar win {
................................................................................
	if {$first == 0 && $last == 1} {
	    hideVScrollbar $win
	}
    }
}

#------------------------------------------------------------------------------
# scrollutil::sa::unlockScrollbar
#------------------------------------------------------------------------------
proc scrollutil::sa::unlockScrollbar {win sb} {
    if {[winfo exists $win] &&
	[string compare [winfo class $win] "Scrollarea"] == 0} {
	upvar ::scrollutil::ns${win}::data data
	set data(${sb}Locked) 0
    }


}































|
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







|
<







 







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







 







|
<







 







|

|



|
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
662
663
664
665
666
667
668
669




670
















671
672
673
674
675
676
677
...
755
756
757
758
759
760
761
762

763
764
765
766
767
768
769
...
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
...
829
830
831
832
833
834
835
836

837
838
839
840
841
842
843
...
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
proc scrollutil::sa::onDynamicHScrollbarMap hsb {
    set top [winfo toplevel $hsb]
    if {![winfo ismapped $top]} {
	return ""
    }

    foreach {first last} [$hsb get] {}
    if {($first == 0 && $last == 1) ||




	![containsTextWidget [winfo parent $hsb]]} {
















	return ""
    }

    #
    # Guard against a potential endless loop by making sure that
    # showing the horizontal scrollbar won't make the toplevel higher
    #
................................................................................
	}
	grid $win.hsb		   -row 2 -column 0 -columnspan 2 -sticky ew
    }
    set data(hsbManaged) 1

    if {[winfo ismapped $win]} {
	set data(hsbLocked) 1
	after $data(-lockinterval) [list scrollutil::sa::unlockHScrollbar $win]

    }
}

#------------------------------------------------------------------------------
# scrollutil::sa::hideHScrollbar
#------------------------------------------------------------------------------
proc scrollutil::sa::hideHScrollbar win {
................................................................................
    if {[string compare $data(-xscrollbarmode) "dynamic"] == 0} {
	foreach {first last} [$win.hsb get] {}
	if {$first == 0 && $last == 1} {
	    hideHScrollbar $win
	}
    }
}

#------------------------------------------------------------------------------
# scrollutil::sa::unlockHScrollbar
#------------------------------------------------------------------------------
proc scrollutil::sa::unlockHScrollbar win {
    if {[winfo exists $win] &&
	[string compare [winfo class $win] "Scrollarea"] == 0} {
	upvar ::scrollutil::ns${win}::data data
	set data(hsbLocked) 0

	if {$data(-lockinterval) <= 1 && ![containsTextWidget $win]} {
	    updateHScrollbar $win
	}
    }
}

#------------------------------------------------------------------------------
# scrollutil::sa::showVScrollbar
#------------------------------------------------------------------------------
proc scrollutil::sa::showVScrollbar {win {redisplay 0}} {
    upvar ::scrollutil::ns${win}::data data
    if {$data(vsbManaged) && !$redisplay} {
................................................................................
	}
	grid $win.vsb		   -row 0 -rowspan 2 -column 2 -sticky ns
    }
    set data(vsbManaged) 1

    if {[winfo ismapped $win]} {
	set data(vsbLocked) 1
	after $data(-lockinterval) [list scrollutil::sa::unlockVScrollbar $win]

    }
}

#------------------------------------------------------------------------------
# scrollutil::sa::hideVScrollbar
#------------------------------------------------------------------------------
proc scrollutil::sa::hideVScrollbar win {
................................................................................
	if {$first == 0 && $last == 1} {
	    hideVScrollbar $win
	}
    }
}

#------------------------------------------------------------------------------
# scrollutil::sa::unlockVScrollbar
#------------------------------------------------------------------------------
proc scrollutil::sa::unlockVScrollbar win {
    if {[winfo exists $win] &&
	[string compare [winfo class $win] "Scrollarea"] == 0} {
	upvar ::scrollutil::ns${win}::data data
	set data(vsbLocked) 0

	if {$data(-lockinterval) <= 1} {
	    updateVScrollbar $win
	}
    }
}

#------------------------------------------------------------------------------
# scrollutil::sa::containsTextWidget
#------------------------------------------------------------------------------
proc scrollutil::sa::containsTextWidget win {
    set widget [::$win widget]
    set class [winfo class $widget]
    if {[string compare $class "Text"]  == 0 ||
	[string compare $class "Ctext"] == 0} {
	return 1
    } elseif {[string compare $class "Scrollsync"] == 0} {
	foreach w [::$widget widgets] {
	    set class [winfo class $w]
	    if {[string compare $class "Text"]  == 0 ||
		[string compare $class "Ctext"] == 0} {
		return 1
	    }
	}
    }

    return 0
}

Changes to modules/scrollutil/scripts/tclIndex.

64
65
66
67
68
69
70

71
72
73
74

75
76
77
78
79
80
81
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]]







>



|
>







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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::unlockHScrollbar) [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::unlockVScrollbar) [list source [file join $dir scrollarea.tcl]]
set auto_index(::scrollutil::sa::containsTextWidget) [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]]

Changes to modules/scrollutil/scripts/wheelEvent.tcl.

38
39
40
41
42
43
44
45
46
47
48
49
50






























51
52
53
54
55
56
57
..
59
60
61
62
63
64
65




66
67
68
69
70
71
72
# 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 {
................................................................................
			      <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 ""
    }







|
|
|



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







 







>
>
>
>







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
..
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Private procedure creating mouse wheel event and <Destroy> bindings
# ===================================================================
#

#------------------------------------------------------------------------------
# scrollutil::createBindings
#
# Creates mouse wheel event bindings for the binding tags Scrollbar,
# TScrollbar, WheeleventRedir, and WheeleventBreak, as well as <Destroy>
# bindings for the binding tags ScrlWidgetCont and WheeleventWidget.
#------------------------------------------------------------------------------
proc scrollutil::createBindings {} {
    variable winSys

    #
    # On the windowing systems win32 and x11 there are no built-in
    # mouse wheel event bindings for the binding tag Scrollbar
    # if the Tk version is earlier than 8.6 -- create them here
    #
    if {$winSys eq "win32" || $winSys eq "x11"} {
	set scrollByUnits [expr {
	    [llength [info commands ::tk::ScrollByUnits]] == 0 ?
	    "tkScrollByUnits" : "tk::ScrollByUnits"}]

	bind Scrollbar <MouseWheel> [format {
	    %s %%W v [expr {%%D >= 0 ? (-%%D) / 30 : (-(%%D) + 29) / 30}]
	} $scrollByUnits]
	bind Scrollbar <Shift-MouseWheel> [format {
	    %s %%W h [expr {%%D >= 0 ? (-%%D) / 30 : (-(%%D) + 29) / 30}]
	} $scrollByUnits]

	if {$winSys eq "x11"} {
	    bind Scrollbar <Button-4>	    [list $scrollByUnits %W v -5]
	    bind Scrollbar <Button-5>	    [list $scrollByUnits %W v  5]
	    bind Scrollbar <Shift-Button-4> [list $scrollByUnits %W h -5]
	    bind Scrollbar <Shift-Button-5> [list $scrollByUnits %W h  5]

	    if {[package vcompare $::tk_patchLevel "8.7a3"] >= 0} {
		bind Scrollbar <Button-6>   [list $scrollByUnits %W h -5]
		bind Scrollbar <Button-7>   [list $scrollByUnits %W h  5]
	    }
	}
    }

    set eventList [list <MouseWheel> <Shift-MouseWheel>]
    switch $winSys {
	aqua {
	    lappend eventList <Option-MouseWheel> <Shift-Option-MouseWheel>
	}
	x11 {
................................................................................
			      <Shift-Button-4> <Shift-Button-5>
	    if {[package vcompare $::tk_patchLevel "8.7a3"] >= 0} {
		lappend eventList <Button-6> <Button-7>
	    }
	}
    }

    #
    # Copy the mouse wheel event bindings of the widget
    # class Scrollbar to the binding tag TScrollbar
    #
    foreach event $eventList {
	bind TScrollbar $event [bind Scrollbar $event]
    }

    if {$winSys eq "win32" && [package vcompare $::tk_patchLevel "8.6b2"] < 0} {
	return ""
    }

Changes to modules/scrollutil/scrollutil.tcl.

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: csaba.nemethi@t-online.de)
#==============================================================================

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
}






|












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: csaba.nemethi@t-online.de)
#==============================================================================

package require -exact scrollutil::common 1.5

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.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

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
    }








|







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

package require Tk 8

namespace eval ::scrollutil {
    #
    # Public variables:
    #
    variable version	1.5
    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
    }

Changes to modules/scrollutil/scrollutil_tile.tcl.

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Copyright (c) 2019-2020  Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
#==============================================================================

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
}







|












4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Copyright (c) 2019-2020  Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
#==============================================================================

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.5

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
}