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

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

Overview
Comment: * scripts/scrollarea.tcl: Added the read-only public variable "scrollutil::scalingpct" and set it to 100, 125, 150, 175, or 200, correspondig to the display's DPI scaling level.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:d47b54cd789d76ed760f90c94093830d24667de031564e11bc4aac34955f9023
User & Date: csaba 2020-06-23 09:56:46
Context
2020-06-23
09:57
* scripts/wheelEvent.tcl: Adapted the bindings to TIP 563, meaning that the mouse wheel now will scroll a horizontal or vertical scrollbar regardless of whether the "Shift" key is down or not. check-in: 2d552bd381 user: csaba tags: trunk
09:56
* scripts/scrollarea.tcl: Added the read-only public variable "scrollutil::scalingpct" and set it to 100, 125, 150, 175, or 200, correspondig to the display's DPI scaling level. check-in: d47b54cd78 user: csaba tags: trunk
09:55
* scripts/scaleutil.tcl: New file containing scaling-related stuff: getting the display's DPI scaling percentage; scaling the default width of the Tk core scrollbars on X11, the default width of the ttk::scrollbar widget in a few built-in themes, the arrows of the ttk::combobox, ttk::spinbox, and ttk::menubutton widgets, and the indicators of the ttk::checkbutton and ttk::radiobutton widgets; a workaround for a long-standing scaling-related bug in the implementation of the ttk::checkbutton and ttk::radiobutton widgets in the "vista" and "xpnative" themes. check-in: 7b9cee071f user: csaba tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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

15
16
17
18
19
20
21
22
23
24
25
26
27
































28
29
30
31
32
33
34
..
56
57
58
59
60
61
62

63
64
65
66
67
68
69
70
71
...
146
147
148
149
150
151
152

153
154
155
156
157
158
159
160
161
162
#==============================================================================

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

namespace eval scrollutil::sa {
    #
    # Get the current windowing system ("x11", "win32", "classic", or "aqua")
    #
    variable winSys [mwutil::windowingSystem]

































    #
    # The array configSpecs is used to handle configuration options.  The names
    # of its elements are the configuration options for the Scrollarea class.
    # The value of an array element is either an alias name or a list
    # containing the database name and class as well as an indicator specifying
    # the widget to which the option applies: f stands for the frame and w for
    # the scrollarea widget itself.
................................................................................
    }

    #
    # Extend the elements of the array configSpecs
    #
    proc extendConfigSpecs {} {
	variable ::scrollutil::usingTile

	variable configSpecs
	variable winSys

	if {$usingTile} {
	    foreach opt {-background -bg -highlightbackground -highlightcolor
			 -highlightthickness} {
		unset configSpecs($opt)
	    }
	} else {
................................................................................
#
# Creates a new scrollarea widget whose name is specified as the first command-
# line argument, and configures it according to the options and their values
# given on the command line.  Returns the name of the newly created widget.
#------------------------------------------------------------------------------
proc scrollutil::scrollarea args {
    variable usingTile

    variable sa::configSpecs
    variable sa::configOpts
    variable sa::winSys

    if {[llength $args] == 0} {
	mwutil::wrongNumArgs "scrollarea pathName ?options?"
    }

    #
    # Create a frame of the class Scrollarea







|

|



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







 







>

<







 







>


<







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
..
88
89
90
91
92
93
94
95
96

97
98
99
100
101
102
103
...
178
179
180
181
182
183
184
185
186
187

188
189
190
191
192
193
194
#==============================================================================

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

namespace eval scrollutil {
    #
    # Get the windowing system ("x11", "win32", "classic", or "aqua")
    #
    variable winSys [mwutil::windowingSystem]

    #
    # Get the display's current scaling percentage (100, 125, 150, 175, or 200)
    #
    variable scalingpct [scaleutil::scalingPercentage $winSys]

    #
    # Make the variable scalingpct read-only
    #
    trace variable scalingpct wu \
	  [list scrollutil::restoreScalingpct $scalingpct]

    #
    # The following trace procedure is executed whenever the
    # variable scalingpct is written or unset.  It restores the
    # variable to its original value, given by the first argument.
    #
    proc restoreScalingpct {origVal varName index op} {
	variable scalingpct $origVal
	switch $op {
	    w {
		return -code error "the variable ::scrollutil::scalingpct is\
				    read-only"
	    }
	    u {
		trace variable scalingpct wu \
		      [list scrollutil::restoreScalingpct $origVal]
	    }
	}
    }
}

namespace eval scrollutil::sa {
    #
    # The array configSpecs is used to handle configuration options.  The names
    # of its elements are the configuration options for the Scrollarea class.
    # The value of an array element is either an alias name or a list
    # containing the database name and class as well as an indicator specifying
    # the widget to which the option applies: f stands for the frame and w for
    # the scrollarea widget itself.
................................................................................
    }

    #
    # Extend the elements of the array configSpecs
    #
    proc extendConfigSpecs {} {
	variable ::scrollutil::usingTile
	variable ::scrollutil::winSys
	variable configSpecs


	if {$usingTile} {
	    foreach opt {-background -bg -highlightbackground -highlightcolor
			 -highlightthickness} {
		unset configSpecs($opt)
	    }
	} else {
................................................................................
#
# Creates a new scrollarea widget whose name is specified as the first command-
# line argument, and configures it according to the options and their values
# given on the command line.  Returns the name of the newly created widget.
#------------------------------------------------------------------------------
proc scrollutil::scrollarea args {
    variable usingTile
    variable winSys
    variable sa::configSpecs
    variable sa::configOpts


    if {[llength $args] == 0} {
	mwutil::wrongNumArgs "scrollarea pathName ?options?"
    }

    #
    # Create a frame of the class Scrollarea