Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | * CHANGES.txt: Updated to reflect the changes. * doc/*.html: |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: | 014399cfac91a7558ec06ffb7d57159ff3973339f3bf0df2ed2b9717c4493b04 |
User & Date: | csaba 2020-06-23 09:52:55 |
Context
2020-06-23
| ||
09:54 | * scripts/mwutil.tcl: Updated. check-in: 2788da0211 user: csaba tags: trunk | |
09:52 | * CHANGES.txt: Updated to reflect the changes. * doc/*.html: check-in: 014399cfac user: csaba tags: trunk | |
09:52 | * *.tcl: Bumped the version number to 1.6. * COPYRIGHT.txt: * README.txt: check-in: 78c98b0f10 user: csaba tags: trunk | |
Changes
Changes to modules/scrollutil/CHANGES.txt.
1 2 3 4 5 6 7 8 9 |
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.
|
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
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 |
What is new in Scrollutil 1.6? ------------------------------ 1. Included the implementation of TIP 563, meaning that the mouse wheel now will scroll a horizontal or vertical Tk core or tile scrollbar widget regardless of whether the "Shift" key is down or not (thanks to Harald Oehlmann for his proposal and TIP implementation). 2. Added the read-only public variable "scrollutil::scalingpct", which is set at application start time to 100, 125, 150, 175, or 200, correspondig to the display's DPI scaling level. See the new section "More on scrollutil::scalingpct" in Scrollutil Programmer's Guide for details. 3. The procedure responsible for the initialization of the variable "scrollutil::scalingpct" also scales: (a) the default width of the Tk core scrollbars on X11; (b) for the built-in themes "alt", "clam", "classic", and "default", the default width of the ttk::scrollbar widget, as well as the arrows of the ttk::combobox and ttk::spinbox widgets; (c) for the "alt" and "clam" themes, the arrow of the ttk::menubutton widget; (d) for the "clam", "classic", and "default" themes, the indicators of the ttk::checkbutton and ttk::radiobutton widgets. 4. Made sure that in the "vista" and "xpnative" themes the indicators of the ttk::checkbutton and ttk::radiobutton widgets will be properly scaled, regardless of the Tk release being used (a long-standing bug in the implementation of these widgets was fixed in May 2020). 5. Made the demo-scripts fully scaling-aware. 6. Several further improvements in the demo scripts and documentation. What was 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. |
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.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> |
| | |
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.6</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.6</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.5</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.6</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.5</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.6</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.5</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.6</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 .. 35 36 37 38 39 40 41 42 43 44 45 46 47 48 ... 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 ... 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 ... 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 ... 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 ... 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 ... 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 ... 544 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 ... 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 ... 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 ... 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 ... 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 ... 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 ... 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 ... 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 .... 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 .... 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 .... 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 .... 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 .... 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 .... 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 .... 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 .... 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 .... 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 |
<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> ................................................................................ <li><a href="#ov_what">What Is Scrollutil?</a></li> <li><a href="#ov_get">How to Get It?</a></li> <li><a href="#ov_install">How to Install It?</a></li> <li><a href="#ov_use">How to Use It?</a></li> </ul> <h4><a href="#examples">Examples</a></h4> <ul> <li><a href="#ex_styleUtil">The Helper Script <code>styleUtil.tcl</code></a></li> ................................................................................ <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. 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. 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. Please take this into account when reading the <a href="#examples">examples</a> below.</p> ................................................................................ </blockquote> <p>command to import the <i>procedures</i> you need, or use qualified names like <code>scrollutil::scrollarea</code>. In the <a href= "#examples">examples</a> below we have chosen the latter approach.</p> <p>To access Scrollutil <i>variables</i>, you <i>must</i> use qualified names. There are only three Scrollutil variables that are designed to be accessed outside the namespace <code>scrollutil</code>:</p> <ul> <li>The variable <code>scrollutil::version</code> holds the current version number of the Scrollutil package.</li> <li>The variable <code>scrollutil::library</code> holds the location of the Scrollutil installation directory.</li> <li>The read-only variable <code>scrollutil::usingTile</code> has the value <code>0</code> in the package Scrollutil and the value <code>1</code> in Scrollutil_tile.</li> </ul> <p>The Scrollutil_tile package checks whether the required Tk and tile ................................................................................ </pre> </blockquote> <p>The second command above reflects the fact that, beginning with Tk 8.5a6, tile is integrated into the Tk core and therefore it should only be loaded explicitly when using an earlier Tk version.</p> <div align="center"> <p><a href="#contents">Contents</a> <a href= "index.html">Start page</a></p> </div> <hr> <h2 id="examples">Examples</h2> <h3 id="ex_styleUtil">The Helper Script <code>styleUtil.tcl</code></h3> <p>All the examples in the <code>demos</code> directory use tile (ttk) widgets and contain the line</p> <blockquote> <pre> source styleUtil.tcl </pre> </blockquote> <p>The script <code>styleUtil.tcl</code> patches a few ttk widget styles and defines the style <code>Small.Toolbutton</code>. In addition, on X11 it sets the theme to a slightly patched variant of the <code>clam</code> theme (having smaller ttk::button widgets as well as ttk::treeview and ................................................................................ directory creates a horizontally and vertically scrolled tablelist widget having two header rows and one title column, and manages the two scrollbars in such a way that the vertical scrollbar appears below the tablelist's header and the horizontal one starts to the right of the widget's title column area:</p> <blockquote> <img src="ScrolledTablelist.png" alt="ScrolledTablelist" width="480" height="337"> </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 # of a frame having -borderwidth 1 and -relief sunken #</span> ................................................................................ grid $hsb -row 2 -column 1 -sticky ew 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 ................................................................................ <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"># # Create the tablelist within a scrollarea #</span> set f [ttk::frame .f] ................................................................................ <span class="red">$sa setwidget $tbl</span> . . . <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 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 ................................................................................ <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> <blockquote> <img src="SyncListboxes.png" alt="SyncListboxes" width="320" height="305"> </blockquote> <p>Here is the relevant code, in which the lines related to the scrollarea and scrollsync widgets 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 . "European Countries" . . . set f [ttk::frame .f] ................................................................................ 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> ................................................................................ <p>The file <code>SyncTablelists.tcl</code> in the <code>demos</code> directory creates three tablelists within a <a href= "scrollsync.html">scrollsync</a> widget, which in turn is embedded into a <a href="scrollarea.html">scrollarea</a>.</p> <blockquote> <img src="SyncTablelists.png" alt="SyncTablelists" width="548" height= "326"> </blockquote> <p>The relevant code is similar to the one shown in the <a href= "#ex_SyncListboxes">previous example</a>:</p> <blockquote> <pre> package require tablelist_tile <span class="red">package require scrollutil_tile</span> source styleUtil.tcl wm title . "Synchronized Tablelists" . . . set f [ttk::frame .f] ................................................................................ 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 ................................................................................ countries, ttk::combobox widgets for selecting the corresponding capital cities, and ttk::button widgets of the style <code>Small.Toolbutton</code> (created by using the procedure <code>createToolbutton</code>, implemented in the file <code><a href="#ex_styleUtil">styleUtil.tcl</a></code>) for the less patient users, displaying the text "Resolve".</p> <blockquote> <img src="ScrollableFrmDemo1.png" alt="ScrollableFrmDemo1" width="407" 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 #</span> set f [ttk::frame .f] ................................................................................ <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" <span class="cmt"># # Create a ScrollableFrame within a scrollarea #</span> set f [ttk::frame .f] ................................................................................ <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"># # Create a scrolledframe ................................................................................ scrollarea.</li> </ul> <p>With the exception of ttk::label, ttk::entry, and ttk::separator, all these widgets have bult-in mouse wheel event bindings.</p> <blockquote> <img src="ScrollableFrmDemo2.png" alt="ScrollableFrmDemo2" width="605" height="516"> </blockquote> <p>Here is the relevant code:</p> <blockquote> <pre> package require Tk 8.5.9 ;<span class= ................................................................................ package require mentry_tile 3.2 ;<span class= "cmt"># for mouse wheel support</span> package require tablelist_tile 6.5 ;<span class= "cmt"># for -(x|y)mousewheelwindow</span> ;<span class= "cmt"># and scrollutil::scrollarea</span> <span class="red">package require scrollutil_tile</span> source styleUtil.tcl wm title . "Scrollutil Demo" <span class="cmt"># # Create a scrollableframe within a scrollarea #</span> set tf [ttk::frame .tf] ................................................................................ set sf [scrollutil::scrollableframe $sa.sf] $sa setwidget $sf</span> <span class="cmt"># # Get the content frame and populate it #</span> <span class="red">set cf [$sf contentframe]</span> source SuScrollableFrmContent.tcl <span class="cmt"># # Make the keyboard navigation more user-friendly #</span> foreach w [list $cb $sb $e $me] { bind $w <<TraverseIn>> [list <span class="red">$sf see %W</span>] } ................................................................................ <code>grid</code>. In case of the ttk::entry widgets we invoke <code>grid</code> with <code>-sticky we</code>. Due to this and the <code>-fitcontentwidth yes</code> scrollableframe setting, the ttk::entry widgets will stretch or shrink whenever the width of the scrollableframe changes as a result of resizing the toplevel window.</p> <blockquote> <img src="TablelistConfig.png" alt="TablelistConfig" width="382" height="403"> </blockquote> <h3 id="ex_BwScrollableFrameDemo2">A Script Using Two BWidget ScrollableFrame Widgets</h3> <p>The script <code>BwScrollableFrmDemo2.tcl</code> in the <code>demos</code> directory creates a BWidget ScrollableFrame embedded into a <a href= ................................................................................ package require mentry_tile 3.2 ;<span class= "cmt"># for mouse wheel support</span> package require tablelist_tile 6.5 ;<span class= "cmt"># for -(x|y)mousewheelwindow</span> ;<span class= "cmt"># and scrollutil::scrollarea</span> <span class="red">package require scrollutil_tile</span> source styleUtil.tcl wm title . "Scrollutil Demo" <span class="cmt"># # Create a ScrollableFrame within a scrollarea #</span> set tf [ttk::frame .tf] ................................................................................ . . . <span class="cmt"># # Get the content frame and populate it #</span> set cf [$sf getframe] source BwScrollableFrmContent.tcl <span class="cmt"># # Make the keyboard navigation more user-friendly #</span> foreach w [list $cb $sb $e $me] { bind $w <<TraverseIn>> [list $sf see %W] } ................................................................................ <pre> package require Tk 8.5.9 ;<span class= "cmt"># for ttk::spinbox</span> 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> package require mentry_tile 3.2 ;<span class= "cmt"># for mouse wheel support</span> package require tablelist_tile 6.5 ;<span class= "cmt"># for -(x|y)mousewheelwindow</span> ;<span class= "cmt"># and scrollutil::scrollarea</span> <span class="red">package require scrollutil_tile</span> source styleUtil.tcl wm title . "Scrollutil Demo" . . . <span class="cmt"># # Create a scrolledframe ................................................................................ . . . <span class="cmt"># # Get the content frame and populate it #</span> set cf [$sf childsite] . . . source ScrolledFrmContent.tcl </pre> </blockquote> <p>The additional stuff related to the mouse wheel events contains exactly the same Scrollutil command invocations as the one in the two previous examples.</p> |
| > > > | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | | > | | > | | | > | | | | > | | | | | > | | | | | > | > | > > | | | | > | | | | > | | | > | | |
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 .. 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 ... 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 ... 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 306 307 308 ... 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 409 410 ... 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 ... 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 ... 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 ... 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 ... 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 ... 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 ... 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 ... 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 ... 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 ... 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 ... 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 .... 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 .... 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 .... 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 .... 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 .... 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 .... 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 .... 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 .... 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 .... 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 .... 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 |
<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.6</h2> <h3>by</h3> <h2>Csaba Nemethi</h2> <address> <a href="mailto:csaba.nemethi@t-online.de">csaba.nemethi@t-online.de</a> ................................................................................ <li><a href="#ov_what">What Is Scrollutil?</a></li> <li><a href="#ov_get">How to Get It?</a></li> <li><a href="#ov_install">How to Install It?</a></li> <li><a href="#ov_use">How to Use It?</a></li> <li><a href="#ov_scaling">More on <code>scrollutil::scalingpct</code></a></li> </ul> <h4><a href="#examples">Examples</a></h4> <ul> <li><a href="#ex_styleUtil">The Helper Script <code>styleUtil.tcl</code></a></li> ................................................................................ <blockquote> <address> <a href="https://www.nemethi.de">https://www.nemethi.de</a> </address> </blockquote> <p>The distribution file is <code>scrollutil1.6.tar.gz</code> for UNIX and <code>scrollutil1_6.zip</code> for Windows. These files contain the same information, except for the additional carriage return character preceding the linefeed at the end of each line in the text files for Windows.</p> <p>Scrollutil is also included in tklib, which has the address</p> <blockquote> ................................................................................ a directory at the same level as the Tcl and Tk script libraries. The locations of these library directories are given by the <code>tcl_library</code> and <code>tk_library</code> variables, respectively.</p> <p>To install Scrollutil <i>on UNIX</i>, <code>cd</code> to the desired directory and unpack the distribution file <code>scrollutil1.6.tar.gz</code>:</p> <blockquote> <pre> gunzip -c scrollutil1.6.tar.gz | tar -xf - </pre> </blockquote> <p>On most UNIX systems this can be replaced with</p> <blockquote> <pre> tar -zxf scrollutil1.6.tar.gz </pre> </blockquote> <p>Both commands will create a directory named <code>scrollutil1.6</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_6.zip</code> into the directory <code>scrollutil1.6</code>, with the subdirectories <code>demos</code>, <code>doc</code>, and <code>scripts</code>.</p> <p>Notice that in tklib the Scrollutil <code>demos</code> directory is replaced with the subdirectory <code>scrollutil</code> of the <code>examples</code> directory. Please take this into account when reading the <a href="#examples">examples</a> below.</p> ................................................................................ </blockquote> <p>command to import the <i>procedures</i> you need, or use qualified names like <code>scrollutil::scrollarea</code>. In the <a href= "#examples">examples</a> below we have chosen the latter approach.</p> <p>To access Scrollutil <i>variables</i>, you <i>must</i> use qualified names. There are only four Scrollutil variables that are designed to be accessed outside the namespace <code>scrollutil</code>:</p> <ul> <li>The variable <code>scrollutil::version</code> holds the current version number of the Scrollutil package.</li> <li>The variable <code>scrollutil::library</code> holds the location of the Scrollutil installation directory.</li> <li>The read-only variable <code>scrollutil::scalingpct</code> holds the scaling percentage corresponding to the display's DPI scaling level. Scrollutil adapts the default width of the Tk core scrollbars on X11 and that of the ttk::scrollbar widget for the built-in themes <code>alt</code>, <code>clam</code>, <code>classic</code>, and <code>default</code> to the value of this variable. The currently supported values are <code>100</code>, <code>125</code>, <code>150</code>, <code>175</code>, and <code>200</code>. You can use this variable, e.g., if you want to create images of different sizes, depending on the DPI scaling level. For example, if your application uses images of size 16 x 16 on an unscaled display and <code>scrollutil::scalingpct</code> has the value <code>150</code>, then the image size for this display should be 24 x 24.</li> <li>The read-only variable <code>scrollutil::usingTile</code> has the value <code>0</code> in the package Scrollutil and the value <code>1</code> in Scrollutil_tile.</li> </ul> <p>The Scrollutil_tile package checks whether the required Tk and tile ................................................................................ </pre> </blockquote> <p>The second command above reflects the fact that, beginning with Tk 8.5a6, tile is integrated into the Tk core and therefore it should only be loaded explicitly when using an earlier Tk version.</p> <h3 id="ov_scaling">More on <code>scrollutil::scalingpct</code></h3> <p>The way Scrollutil initializes the variable <code>scrollutil::scalingpct</code> depends on the windowing system:</p> <p><i>On Windows and Mac OS X Aqua</i> the scaling percentage is computed from <code>[tk scaling]</code>. Note that on Mac OS X the result is always <code>100</code>, regardless of the display's scaling level. On this system the desktop engine automatically scales everything as needed.</p> <p><i>On X11</i>, computing the scaling percentage from <code>[tk scaling]</code> is done as fallback method only, because the implementation of display scaling is highly dependent on the desktop environment and it mostly manipulates system resources that are resident outside of Xlib, which Tk is based on. (Traditional X applications like <code>bitmap</code> and <code>xmag</code> are also affected by this.) With the exception of Xfce and MATE, Scrollutil computes the scaling percentage from the value of the X resource <code>Xft.dpi</code>, by executing the <code>xrdb</code> application. On GNOME-based systems where <code>xrdb</code> is not installed per default (e.g., Solus GNOME and Solus Budgie), it uses the <code>xrandr</code> application and the file <code>~/.config/monitors.xml</code> instead.</p> <ul> <li class="tm">On <i>Xfce and MATE</i> the display scaling mode can be either unscaled (1x, normal) or scaled (2x, HiDPI), and the variable <code>scrollutil::scalingpct</code> will be set accordingly to <code>100</code> or <code>200</code>.</li> <li class="tm">In case of <i>GNOME on Xorg, Budgie, and Cinnamon versions earlier than 4.6</i>, the display scaling can be either 100 % or 200 %, and Scrollutil sets the variable <code>scrollutil::scalingpct</code> accordingly to <code>100</code> or <code>200</code>. In newer GNOME and Budgie versions on Ubuntu one can enable the <code>x11-randr-fractional-scaling</code> as experimental feature, which adds 125 %, 150 %, and 175 % to the list of supported scaling percentages. Note that, due to the way this fractional scaling is implemented, if the display scaling was set to one of these intermediate levels, the value of <code>scrollutil::scalingpct</code> will be <code>200</code>. The same is valid for the fractional scaling support on Cinnamon, introduced in version 4.6.</li> <li class="tm"><i>GNOME on Wayland</i> traditionally supports the display scaling values 100 % and 200 %, and the variable <code>scrollutil::scalingpct</code> will be set accordingly to <code>100</code> or <code>200</code>. In newer GNOME versions one can enable the experimental feature <code>scale-monitor-framebuffer</code>, which adds 125 %, 150 %, and 175 % to the list of supported scaling percentages. With this feature enabled, the value of <code>scrollutil::scalingpct</code> will be <code>100</code> for all scaling levels 100 %, 125 %, ..., 200 %. This is due to the fact that in this case, instead of window contents, monitor framebuffers will be scaled in a logical pixel coordinate space.</li> <li class="tm"><i>KDE Plasma on Xorg</i> provides fractional scaling support. On this desktop, Scrollutil will set the variable <code>scrollutil::scalingpct</code> to <code>100</code>, <code>125</code>, <code>150</code>, <code>175</code>, or <code>200</code>, depending on the display's scaling level.</li> <li class="tm"><i>KDE Plasma on Wayland</i> supports fractional scaling, too. In this case, the value of the variable <code>scrollutil::scalingpct</code> will always be <code>100</code>, regardless of the display's scaling level.</li> </ul> <p>After getting the scaling percentage on X11, Scrollutil sets the scaling factor to be used by Tk to convert between physical units and pixels, by passing the scaling factor corresponding to the scaling percentage to the <code>[tk scaling]</code> command.</p> <p>When initializing the variable <code>scrollutil::scalingpct</code> on X11, Scrollutil also corrects the sizes of the standard fonts if needed. These fonts (<code>TkDefaultFont</code>, <code>TkTextFont</code>, etc.) are defined in the file <code>$tk_library/ttk/fonts.tcl</code>. For quite a long time, the font sizes for X11 given in this file were sizes in pixels, which was not suitable for use on HiDPI displays. This caused several Linux distributions to bundle patched versions of this file, in which the sizes in pixels are replaced with sizes in points. The same fix was committed in February 2020 into the Tk core repository. To make sure that, regardless of the Tk version, the font sizes will suit the display's scaling level, Scrollutil examines this library file and, if the latter contains sizes in pixels, then it sets the <code>-size</code> option of the standard fonts to corresponding sizes in points (without altering the file). In addition, for the HiDPI mode on Xfce and MATE, Scrollutil doubles the sizes (in points) of the standard fonts (the way display scaling works on these desktops makes this necessary).</p> <p>Independently of the windowing system, the code responsible for the initialization of the variable <code>scrollutil::scalingpct</code> also scales:</p> <ul> <li>the default width of the Tk core scrollbars on X11;</li> <li>for the built-in themes <code>alt</code>, <code>clam</code>, <code>classic</code>, and <code>default</code>, the default width of the ttk::scrollbar widget, as well as the arrows of the ttk::combobox and ttk::spinbox widgets;</li> <li>for the <code>alt</code> and <code>clam</code> themes, the arrow of the ttk::menubutton widget;</li> <li>for the <code>clam</code>, <code>classic</code>, and <code>default</code> themes, the indicators of the ttk::checkbutton and ttk::radiobutton widgets.</li> </ul> <p>In addition, the above-mentioned variable initialization code makes sure that in the <code>vista</code> and <code>xpnative</code> themes the indicators of the ttk::checkbutton and ttk::radiobutton widgets will appear properly scaled, regardless of the Tk release being used. (A long-standing bug in the implementation of these widgets was fixed in May 2020, but Scrollutil provides a workaround for the Tk versions that are still affected by this bug.)</p> <div align="center"> <p><a href="#contents">Contents</a> <a href= "index.html">Start page</a></p> </div> <hr> <h2 id="examples">Examples</h2> <h3 id="ex_styleUtil">The Helper Script <code>styleUtil.tcl</code></h3> <p>All the examples in the <code>demos</code> directory use tile (ttk) widgets and contain the lines</p> <blockquote> <pre> set dir [file dirname [info script]] source [file join $dir styleUtil.tcl] </pre> </blockquote> <p>The script <code>styleUtil.tcl</code> patches a few ttk widget styles and defines the style <code>Small.Toolbutton</code>. In addition, on X11 it sets the theme to a slightly patched variant of the <code>clam</code> theme (having smaller ttk::button widgets as well as ttk::treeview and ................................................................................ directory creates a horizontally and vertically scrolled tablelist widget having two header rows and one title column, and manages the two scrollbars in such a way that the vertical scrollbar appears below the tablelist's header and the horizontal one starts to the right of the widget's title column area:</p> <blockquote> <img src="ScrolledTablelist.png" alt="ScrolledTablelist" width="478" height="335"> </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 set dir [file dirname [info script]] source [file join $dir styleUtil.tcl] wm title . "Scrolled Tablelist" <span class="cmt"># # Create the tablelist and the scrollbars as children # of a frame having -borderwidth 1 and -relief sunken #</span> ................................................................................ grid $hsb -row 2 -column 1 -sticky ew 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 7p -pady 7p 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 ................................................................................ <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> set dir [file dirname [info script]] source [file join $dir styleUtil.tcl] wm title . "Scrolled Tablelist" <span class="cmt"># # Create the tablelist within a scrollarea #</span> set f [ttk::frame .f] ................................................................................ <span class="red">$sa setwidget $tbl</span> . . . <span class="cmt"># # Manage the scrollarea #</span> pack $sa -expand yes -fill both -padx 7p -pady 7p 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="399" height="335"> </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> set dir [file dirname [info script]] source [file join $dir 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 1.5p -spacing3 1.5p -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 tag add bgRed 25.0 25.end . . . <span class="cmt"># # Manage the scrollarea #</span> pack $sa -expand yes -fill both -padx 7p -pady 7p 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 ................................................................................ <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> <blockquote> <img src="SyncListboxes.png" alt="SyncListboxes" width="318" height="302"> </blockquote> <p>Here is the relevant code, in which the lines related to the scrollarea and scrollsync widgets are shown in <span class="red">red</span> color:</p> <blockquote> <pre> <span class="red">package require scrollutil_tile</span> set dir [file dirname [info script]] source [file join $dir styleUtil.tcl] wm title . "European Countries" . . . set f [ttk::frame .f] ................................................................................ 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 1.5p} 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 7p -pady {1.5p 7p} pack $f -expand yes -fill both . . . </pre> </blockquote> <h3 id="ex_SyncTablelists">Synchronizing Three tablelist Widgets</h3> ................................................................................ <p>The file <code>SyncTablelists.tcl</code> in the <code>demos</code> directory creates three tablelists within a <a href= "scrollsync.html">scrollsync</a> widget, which in turn is embedded into a <a href="scrollarea.html">scrollarea</a>.</p> <blockquote> <img src="SyncTablelists.png" alt="SyncTablelists" width="546" height= "323"> </blockquote> <p>The relevant code is similar to the one shown in the <a href= "#ex_SyncListboxes">previous example</a>:</p> <blockquote> <pre> package require tablelist_tile <span class="red">package require scrollutil_tile</span> set dir [file dirname [info script]] source [file join $dir styleUtil.tcl] wm title . "Synchronized Tablelists" . . . set f [ttk::frame .f] ................................................................................ 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 1.5p} 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 7p -pady {1.5p 7p} pack $f -expand yes -fill both . . . </pre> </blockquote> <p>Notice that column #1 of the three tablelist widgets is 40, 60, and 80 ................................................................................ countries, ttk::combobox widgets for selecting the corresponding capital cities, and ttk::button widgets of the style <code>Small.Toolbutton</code> (created by using the procedure <code>createToolbutton</code>, implemented in the file <code><a href="#ex_styleUtil">styleUtil.tcl</a></code>) for the less patient users, displaying the text "Resolve".</p> <blockquote> <img src="ScrollableFrmDemo1.png" alt="ScrollableFrmDemo1" width="403" height="370"> </blockquote> <p>Here is the relevant code:</p> <blockquote> <pre> <span class="red">package require scrollutil_tile</span> set dir [file dirname [info script]] source [file join $dir styleUtil.tcl] wm title . "European Capitals Quiz" <span class="cmt"># # Create a scrollableframe within a scrollarea #</span> set f [ttk::frame .f] ................................................................................ <p>Here is the relevant code:</p> <blockquote> <pre> package require BWidget Widget::theme yes <span class="red">package require scrollutil_tile</span> set dir [file dirname [info script]] source [file join $dir styleUtil.tcl] wm title . "European Capitals Quiz" <span class="cmt"># # Create a ScrollableFrame within a scrollarea #</span> set f [ttk::frame .f] ................................................................................ <blockquote> <pre> if {[catch {package require iwidgets} result1] != 0 && [catch {package require Iwidgets} result2] != 0} { error "$result1; $result2" } set dir [file dirname [info script]] source [file join $dir scrolledwidgetPatch.itk] ;<span class= "cmt"># adds ttk::scrollbar widgets</span> <span class="red">package require scrollutil_tile</span> source [file join $dir styleUtil.tcl] wm title . "European Capitals Quiz" . . . <span class="cmt"># # Create a scrolledframe ................................................................................ scrollarea.</li> </ul> <p>With the exception of ttk::label, ttk::entry, and ttk::separator, all these widgets have bult-in mouse wheel event bindings.</p> <blockquote> <img src="ScrollableFrmDemo2.png" alt="ScrollableFrmDemo2" width="601" height="511"> </blockquote> <p>Here is the relevant code:</p> <blockquote> <pre> package require Tk 8.5.9 ;<span class= ................................................................................ package require mentry_tile 3.2 ;<span class= "cmt"># for mouse wheel support</span> package require tablelist_tile 6.5 ;<span class= "cmt"># for -(x|y)mousewheelwindow</span> ;<span class= "cmt"># and scrollutil::scrollarea</span> <span class="red">package require scrollutil_tile</span> set dir [file dirname [info script]] source [file join $dir styleUtil.tcl] wm title . "Scrollutil Demo" <span class="cmt"># # Create a scrollableframe within a scrollarea #</span> set tf [ttk::frame .tf] ................................................................................ set sf [scrollutil::scrollableframe $sa.sf] $sa setwidget $sf</span> <span class="cmt"># # Get the content frame and populate it #</span> <span class="red">set cf [$sf contentframe]</span> source [file join $dir SuScrollableFrmContent.tcl] <span class="cmt"># # Make the keyboard navigation more user-friendly #</span> foreach w [list $cb $sb $e $me] { bind $w <<TraverseIn>> [list <span class="red">$sf see %W</span>] } ................................................................................ <code>grid</code>. In case of the ttk::entry widgets we invoke <code>grid</code> with <code>-sticky we</code>. Due to this and the <code>-fitcontentwidth yes</code> scrollableframe setting, the ttk::entry widgets will stretch or shrink whenever the width of the scrollableframe changes as a result of resizing the toplevel window.</p> <blockquote> <img src="TablelistConfig.png" alt="TablelistConfig" width="380" height="400"> </blockquote> <h3 id="ex_BwScrollableFrameDemo2">A Script Using Two BWidget ScrollableFrame Widgets</h3> <p>The script <code>BwScrollableFrmDemo2.tcl</code> in the <code>demos</code> directory creates a BWidget ScrollableFrame embedded into a <a href= ................................................................................ package require mentry_tile 3.2 ;<span class= "cmt"># for mouse wheel support</span> package require tablelist_tile 6.5 ;<span class= "cmt"># for -(x|y)mousewheelwindow</span> ;<span class= "cmt"># and scrollutil::scrollarea</span> <span class="red">package require scrollutil_tile</span> set dir [file dirname [info script]] source [file join $dir styleUtil.tcl] wm title . "Scrollutil Demo" <span class="cmt"># # Create a ScrollableFrame within a scrollarea #</span> set tf [ttk::frame .tf] ................................................................................ . . . <span class="cmt"># # Get the content frame and populate it #</span> set cf [$sf getframe] source [file join $dir BwScrollableFrmContent.tcl] <span class="cmt"># # Make the keyboard navigation more user-friendly #</span> foreach w [list $cb $sb $e $me] { bind $w <<TraverseIn>> [list $sf see %W] } ................................................................................ <pre> package require Tk 8.5.9 ;<span class= "cmt"># for ttk::spinbox</span> if {[catch {package require iwidgets} result1] != 0 && [catch {package require Iwidgets} result2] != 0} { error "$result1; $result2" } set dir [file dirname [info script]] source [file join $dir scrolledwidgetPatch.itk] ;<span class= "cmt"># adds ttk::scrollbar widgets</span> package require mentry_tile 3.2 ;<span class= "cmt"># for mouse wheel support</span> package require tablelist_tile 6.5 ;<span class= "cmt"># for -(x|y)mousewheelwindow</span> ;<span class= "cmt"># and scrollutil::scrollarea</span> <span class="red">package require scrollutil_tile</span> source [file join $dir styleUtil.tcl] wm title . "Scrollutil Demo" . . . <span class="cmt"># # Create a scrolledframe ................................................................................ . . . <span class="cmt"># # Get the content frame and populate it #</span> set cf [$sf childsite] . . . source [file join $dir ScrolledFrmContent.tcl] </pre> </blockquote> <p>The additional stuff related to the mouse wheel events contains exactly the same Scrollutil command invocations as the one in the two previous examples.</p> |
Changes to modules/scrollutil/doc/wheelEvent.html.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
<div align="center">
<h1>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>
|
| |
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
<div align="center">
<h1>Commands Related to Mouse Wheel Event Handling</h1>
<h2>For Scrollutil Version 1.6</h2>
<h3>by</h3>
<h2>Csaba Nemethi</h2>
<address>
<a href="mailto:csaba.nemethi@t-online.de">csaba.nemethi@t-online.de</a>
|