Tk Library Source Code

Check-in [f8e9264174]
Login

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

Overview
Comment:Scrollutil: Geometry management for scrollednotebook slightly improved.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f8e9264174344d4e17d773e6df9199c5beceadb805874fbf2b6954966b9217c9
User & Date: csaba 2024-02-16 19:36:14.678
Context
2024-02-28
10:45
Tablelist: Improvements in the documentation and tablelistSort.tcl. check-in: 0c62b27f3c user: csaba tags: trunk
2024-02-16
19:36
Scrollutil: Geometry management for scrollednotebook slightly improved. check-in: f8e9264174 user: csaba tags: trunk
2024-02-11
13:19
Mentry: Updated for version 4.1. See the ChangeLog for details. check-in: d9980621bd user: csaba tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to modules/scrollutil/CHANGES.txt.
1
2
3




4
5
6
7
8
9
10
11
What is new in Scrollutil 2.1?
------------------------------





1. Fixed a typo in the mega-widget utility file mwutil.tcl, introduced
   in the previous release (thanks to Harald Oehlmann for his bug
   report).

What was new in Scrollutil 2.0?
-------------------------------

1. Dropped the support for Tk versions earlier than 8.4.  This has made



>
>
>
>
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
What is new in Scrollutil 2.1?
------------------------------

1. The scrollableframe within a scrollednotebook widget is now packed
   with a horizontal and vertical padding of 0 when both arrow buttons
   are in unmanaged state.

2. Fixed a typo in the mega-widget utility file mwutil.tcl, introduced
   in the previous release (thanks to Harald Oehlmann for his bug
   report).

What was new in Scrollutil 2.0?
-------------------------------

1. Dropped the support for Tk versions earlier than 8.4.  This has made
Changes to modules/scrollutil/scripts/scrollednotebook.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#==============================================================================
# Contains the implementation of the scrollednotebook widget.
#
# Structure of the module:
#   - Namespace initialization
#   - Private procedure creating the default bindings
#   - Public procedures
#   - Private configuration procedures
#   - Private procedures implementing the scrollednotebook widget command
#   - Private callback procedure
#   - Private procedures used in bindings
#   - Private utility procedures
#
# Copyright (c) 2021-2023  Csaba Nemethi (E-mail: [email protected])
#==============================================================================

#
# Namespace initialization
# ========================
#














|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#==============================================================================
# Contains the implementation of the scrollednotebook widget.
#
# Structure of the module:
#   - Namespace initialization
#   - Private procedure creating the default bindings
#   - Public procedures
#   - Private configuration procedures
#   - Private procedures implementing the scrollednotebook widget command
#   - Private callback procedure
#   - Private procedures used in bindings
#   - Private utility procedures
#
# Copyright (c) 2021-2024  Csaba Nemethi (E-mail: [email protected])
#==============================================================================

#
# Namespace initialization
# ========================
#

290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
    #
    # Create a scrollableframe and a ttk::notebook in its content frame
    #
    set sf [scrollableframe $win.sf -borderwidth 0 -contentheight 0 \
	    -contentwidth 0 -fitcontentheight 1 -relief flat -takefocus 0 \
	    -xscrollincrement 1 -yscrollcommand "" -yscrollincrement 1]
    $sf autofillx 1	;# sets/clears the -fitcontentwidth option dynamically
    pack $sf -expand 1 -fill both -padx 3p
    set cf [$sf contentframe]
    set nb [ttk::notebook $cf.nb -height 0 -width 0]
    pack $nb -expand 1 -fill both

    bindtags $nb [linsert [bindtags $nb] 1 SnbNb]

    #







|







290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
    #
    # Create a scrollableframe and a ttk::notebook in its content frame
    #
    set sf [scrollableframe $win.sf -borderwidth 0 -contentheight 0 \
	    -contentwidth 0 -fitcontentheight 1 -relief flat -takefocus 0 \
	    -xscrollincrement 1 -yscrollcommand "" -yscrollincrement 1]
    $sf autofillx 1	;# sets/clears the -fitcontentwidth option dynamically
    pack $sf -expand 1 -fill both
    set cf [$sf contentframe]
    set nb [ttk::notebook $cf.nb -height 0 -width 0]
    pack $nb -expand 1 -fill both

    bindtags $nb [linsert [bindtags $nb] 1 SnbNb]

    #
551
552
553
554
555
556
557



558
559
560
561
562
563
564
565
566
567
		    $data(sf) configure $opt [winfo reqheight $data(nb)]
		}
		-style {
		    if {$val eq ""} {
			set val TNotebook
		    }
		    set tabPos [ttk::style lookup $val -tabposition {} nw]



		    switch -- [string index $tabPos 0] {
			n { pack configure $data(sf) -pady {3p 0} }
			s { pack configure $data(sf) -pady {0 3p} }
			default {
			    return -code error "only horizontal tab layouts\
						are supported"
			}
		    }
		}
	    }







>
>
>

|
|







551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
		    $data(sf) configure $opt [winfo reqheight $data(nb)]
		}
		-style {
		    if {$val eq ""} {
			set val TNotebook
		    }
		    set tabPos [ttk::style lookup $val -tabposition {} nw]
		    set lMan [winfo manager $data(lArrow)]
		    set rMan [winfo manager $data(rArrow)]
		    set pad [expr {$lMan eq "" && $rMan eq "" ? 0 : "3p"}]
		    switch -- [string index $tabPos 0] {
			n { pack configure $data(sf) -pady [list $pad 0] }
			s { pack configure $data(sf) -pady [list 0 $pad] }
			default {
			    return -code error "only horizontal tab layouts\
						are supported"
			}
		    }
		}
	    }
1777
1778
1779
1780
1781
1782
1783

1784
1785
1786
1787
1788
1789
1790
	return ""
    }

    upvar ::scrollutil::ns${win}::data data
    unset data(arrowsId)

    set nb     $data(nb)

    set lArrow $data(lArrow)
    set rArrow $data(rArrow)

    foreach {leftTabIdx leftCompl rightTabIdx rightCompl} [tabsView $win] {}
    set data(leftTabIdx)  $leftTabIdx
    set data(leftCompl)   $leftCompl
    set data(rightTabIdx) $rightTabIdx







>







1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
	return ""
    }

    upvar ::scrollutil::ns${win}::data data
    unset data(arrowsId)

    set nb     $data(nb)
    set sf     $data(sf)
    set lArrow $data(lArrow)
    set rArrow $data(rArrow)

    foreach {leftTabIdx leftCompl rightTabIdx rightCompl} [tabsView $win] {}
    set data(leftTabIdx)  $leftTabIdx
    set data(leftCompl)   $leftCompl
    set data(rightTabIdx) $rightTabIdx
1823
1824
1825
1826
1827
1828
1829









1830
1831
1832
1833
1834
1835
1836
	place forget $rArrow

	if {[string match "*scrollutil::snb::seeNextTab*" \
	     $::ttk::Repeat(script)]} {
	    ::ttk::CancelRepeat
	}
    }









}

#------------------------------------------------------------------------------
# scrollutil::snb::activateTab
#
# Activates the tab data(tabIdx) of the scrollednotebook widget win.
#------------------------------------------------------------------------------







>
>
>
>
>
>
>
>
>







1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
	place forget $rArrow

	if {[string match "*scrollutil::snb::seeNextTab*" \
	     $::ttk::Repeat(script)]} {
	    ::ttk::CancelRepeat
	}
    }

    set lMan [winfo manager $lArrow]
    set rMan [winfo manager $rArrow]
    set pad [expr {$lMan eq "" && $rMan eq "" ? 0 : "3p"}]
    pack configure $sf -padx $pad
    switch -- $tabSide {
	n { pack configure $sf -pady [list $pad 0] }
	s { pack configure $sf -pady [list 0 $pad] }
    }
}

#------------------------------------------------------------------------------
# scrollutil::snb::activateTab
#
# Activates the tab data(tabIdx) of the scrollednotebook widget win.
#------------------------------------------------------------------------------