Tk Library Source Code

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

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

Overview
Comment: * doc/*.html: Updated to reflect the changes; several improvements.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8bea1af9808fcf2242485aee5d244e3faab838d63b32c5f924e43c101c8b4a63
User & Date: csaba 2020-02-05 18:10:50
Context
2020-02-05
18:12
* doc/ScrolledText.png: Added. check-in: cfd796f297 user: csaba tags: trunk
18:10
* doc/*.html: Updated to reflect the changes; several improvements. check-in: 8bea1af980 user: csaba tags: trunk
18:10
* scripts/tclIndex: Newly generated. check-in: f72a365dc0 user: csaba tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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:[email protected]">[email protected]</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:[email protected]">[email protected]</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:[email protected]">[email protected]</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:[email protected]">[email protected]</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:[email protected]">[email protected]</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:[email protected]">[email protected]</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:[email protected]">[email protected]</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:[email protected]">[email protected]</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:[email protected]">[email protected]</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:[email protected]">[email protected]</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 cover
  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
  covered 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 cover 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:[email protected]">[email protected]</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:[email protected]">[email protected]</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=