Skip to content

Commit c10f160

Browse files
author
csaba
committed
* ../../examples/scrollutil/*.tcl: Using the "autosize" scrollableframe
subcommand; several improvements; updated the copyright information.
1 parent 1d18340 commit c10f160

15 files changed

+33
-78
lines changed

examples/scrollutil/BwScrollableFrmContent.tcl

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Populates the content frame of the BWidget ScrollableFrame widget created in
33
# the demo script BwScrollableFrmDemo2.tcl.
44
#
5-
# Copyright (c) 2019-2020 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
5+
# Copyright (c) 2019-2021 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
66
#==============================================================================
77

88
#
@@ -377,33 +377,18 @@ proc configTablelist {} {
377377
switch -- $opt {
378378
-activestyle { set values {frame none underline} }
379379
-arrowstyle {
380-
set values {flat5x3 flat5x4 flat6x4 flat7x4 flat7x5
381-
flat7x7 flat8x4 flat8x5 flat9x5 flat9x6 flat11x6
382-
flat15x8 flatAngle7x4 flatAngle7x5 flatAngle9x5
383-
flatAngle9x6 flatAngle9x7 flatAngle10x6
384-
flatAngle10x7 flatAngle11x6 flatAngle15x8 photo7x4
385-
photo7x7 photo9x5 photo11x6 photo15x8 sunken8x7
386-
sunken10x9 sunken12x11}
380+
set values $tablelist::arrowStyles ;# dirty, but safe
387381
}
388382
-incrarrowtype { set values {up down} }
389383
-labelrelief -
390384
-relief {
391385
set values {flat groove raised ridge solid sunken}
392386
}
393-
-selectmode {
394-
set values {single browse multiple extended}
395-
}
387+
-selectmode { set values {single browse multiple extended} }
396388
-selecttype { set values {row cell} }
397389
-state { set values {disabled normal} }
398390
-treestyle {
399-
set values {adwaita ambiance aqua arc baghira bicolor1
400-
bicolor2 bicolor3 bicolor4 blueMenta classic1 classic2
401-
classic3 classic4 dust dustSand gtk klearlooks mate
402-
menta mint mint2 newWave oxygen1 oxygen2 phase plain1
403-
plain2 plain3 plain4 plastik plastique radiance ubuntu
404-
ubuntu2 ubuntu3 ubuntuMate vistaAero vistaClassic
405-
win7Aero win7Classic win10 winnative winxpBlue
406-
winxpOlive winxpSilver yuyo}
391+
set values $tablelist::treeStyles ;# dirty, but safe
407392
}
408393
}
409394

@@ -423,6 +408,7 @@ proc configTablelist {} {
423408
-autoscan -
424409
-customdragsource -
425410
-displayondemand -
411+
-editendonfocusout -
426412
-editselectedonly -
427413
-exportselection -
428414
-forceeditendcommand -

examples/scrollutil/BwScrollableFrmDemo1.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Demonstrates the use of the Scrollutil package in connection with the BWidget
55
# ScrollableFrame widget.
66
#
7-
# Copyright (c) 2019-2020 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
7+
# Copyright (c) 2019-2021 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
88
#==============================================================================
99

1010
package require BWidget

examples/scrollutil/BwScrollableFrmDemo2.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Demonstrates the use of the Scrollutil package in connection with the BWidget
55
# ScrollableFrame widget.
66
#
7-
# Copyright (c) 2019-2020 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
7+
# Copyright (c) 2019-2021 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
88
#==============================================================================
99

1010
package require Tk 8.5.9 ;# for ttk::spinbox

examples/scrollutil/ScrolledFrmContent.tcl

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Populates the content frame of the iwidgets::scrolledframe widget created in
33
# the demo script ScrolledFrmDemo2.tcl.
44
#
5-
# Copyright (c) 2019-2020 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
5+
# Copyright (c) 2019-2021 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
66
#==============================================================================
77

88
#
@@ -380,33 +380,18 @@ proc configTablelist {} {
380380
switch -- $opt {
381381
-activestyle { set values {frame none underline} }
382382
-arrowstyle {
383-
set values {flat5x3 flat5x4 flat6x4 flat7x4 flat7x5
384-
flat7x7 flat8x4 flat8x5 flat9x5 flat9x6 flat11x6
385-
flat15x8 flatAngle7x4 flatAngle7x5 flatAngle9x5
386-
flatAngle9x6 flatAngle9x7 flatAngle10x6
387-
flatAngle10x7 flatAngle11x6 flatAngle15x8 photo7x4
388-
photo7x7 photo9x5 photo11x6 photo15x8 sunken8x7
389-
sunken10x9 sunken12x11}
383+
set values $tablelist::arrowStyles ;# dirty, but safe
390384
}
391385
-incrarrowtype { set values {up down} }
392386
-labelrelief -
393387
-relief {
394388
set values {flat groove raised ridge solid sunken}
395389
}
396-
-selectmode {
397-
set values {single browse multiple extended}
398-
}
390+
-selectmode { set values {single browse multiple extended} }
399391
-selecttype { set values {row cell} }
400392
-state { set values {disabled normal} }
401393
-treestyle {
402-
set values {adwaita ambiance aqua arc baghira bicolor1
403-
bicolor2 bicolor3 bicolor4 blueMenta classic1 classic2
404-
classic3 classic4 dust dustSand gtk klearlooks mate
405-
menta mint mint2 newWave oxygen1 oxygen2 phase plain1
406-
plain2 plain3 plain4 plastik plastique radiance ubuntu
407-
ubuntu2 ubuntu3 ubuntuMate vistaAero vistaClassic
408-
win7Aero win7Classic win10 winnative winxpBlue
409-
winxpOlive winxpSilver yuyo}
394+
set values $tablelist::treeStyles ;# dirty, but safe
410395
}
411396
}
412397

@@ -426,6 +411,7 @@ proc configTablelist {} {
426411
-autoscan -
427412
-customdragsource -
428413
-displayondemand -
414+
-editendonfocusout -
429415
-editselectedonly -
430416
-exportselection -
431417
-forceeditendcommand -

examples/scrollutil/ScrolledFrmDemo1.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Demonstrates the use of the Scrollutil package in connection with the
55
# iwidgets::scrolledframe widget.
66
#
7-
# Copyright (c) 2019-2020 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
7+
# Copyright (c) 2019-2021 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
88
#==============================================================================
99

1010
if {[catch {package require iwidgets} result1] != 0 &&

examples/scrollutil/ScrolledFrmDemo2.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Demonstrates the use of the Scrollutil package in connection with the
55
# iwidgets::scrolledframe widget.
66
#
7-
# Copyright (c) 2019-2020 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
7+
# Copyright (c) 2019-2021 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
88
#==============================================================================
99

1010
package require Tk 8.5.9 ;# for ttk::spinbox

examples/scrollutil/ScrolledTablelist1.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Demonstrates the traditional scrollbar management in connection with a
55
# tablelist widget.
66
#
7-
# Copyright (c) 2019-2020 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
7+
# Copyright (c) 2019-2021 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
88
#==============================================================================
99

1010
package require Tk 8.5

examples/scrollutil/ScrolledTablelist2.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Demonstrates the use of the scrollutil::scrollarea widget in connection with
55
# a tablelist.
66
#
7-
# Copyright (c) 2019-2020 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
7+
# Copyright (c) 2019-2021 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
88
#==============================================================================
99

1010
package require Tk 8.5

examples/scrollutil/ScrolledText.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Demonstrates the use of the scrollutil::scrollarea widget in connection with
55
# a text widget.
66
#
7-
# Copyright (c) 2020 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
7+
# Copyright (c) 2020-2021 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
88
#==============================================================================
99

1010
package require scrollutil_tile

examples/scrollutil/SuScrollableFrmContent.tcl

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Populates the content frame of the scrollutil::scrollableframe widget created
33
# in the demo script SuScrollableFrmDemo2.tcl.
44
#
5-
# Copyright (c) 2019-2020 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
5+
# Copyright (c) 2019-2021 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
66
#==============================================================================
77

88
#
@@ -254,11 +254,10 @@ foreach colId [$tv cget -columns] {
254254
# Set the scrollableframe's width, height, and yscrollincrement
255255
#
256256
wm withdraw .
257-
update idletasks
258-
set width [winfo reqwidth $cf]
257+
$sf autosize w
259258
set height [expr {[winfo reqheight $cf.l0] + [winfo pixels . 4p] + \
260259
[winfo reqheight $cf.sa1] + 2*[winfo pixels . 7p]}]
261-
$sf configure -width $width -height $height \
260+
$sf configure -height $height \
262261
-yscrollincrement [expr {[winfo reqheight $lb] / 10}]
263262

264263
pack $sa -expand yes -fill both -padx 7p -pady 7p
@@ -362,33 +361,18 @@ proc configTablelist {} {
362361
switch -- $opt {
363362
-activestyle { set values {frame none underline} }
364363
-arrowstyle {
365-
set values {flat5x3 flat5x4 flat6x4 flat7x4 flat7x5
366-
flat7x7 flat8x4 flat8x5 flat9x5 flat9x6 flat11x6
367-
flat15x8 flatAngle7x4 flatAngle7x5 flatAngle9x5
368-
flatAngle9x6 flatAngle9x7 flatAngle10x6
369-
flatAngle10x7 flatAngle11x6 flatAngle15x8 photo7x4
370-
photo7x7 photo9x5 photo11x6 photo15x8 sunken8x7
371-
sunken10x9 sunken12x11}
364+
set values $tablelist::arrowStyles ;# dirty, but safe
372365
}
373366
-incrarrowtype { set values {up down} }
374367
-labelrelief -
375368
-relief {
376369
set values {flat groove raised ridge solid sunken}
377370
}
378-
-selectmode {
379-
set values {single browse multiple extended}
380-
}
371+
-selectmode { set values {single browse multiple extended} }
381372
-selecttype { set values {row cell} }
382373
-state { set values {disabled normal} }
383374
-treestyle {
384-
set values {adwaita ambiance aqua arc baghira bicolor1
385-
bicolor2 bicolor3 bicolor4 blueMenta classic1 classic2
386-
classic3 classic4 dust dustSand gtk klearlooks mate
387-
menta mint mint2 newWave oxygen1 oxygen2 phase plain1
388-
plain2 plain3 plain4 plastik plastique radiance ubuntu
389-
ubuntu2 ubuntu3 ubuntuMate vistaAero vistaClassic
390-
win7Aero win7Classic win10 winnative winxpBlue
391-
winxpOlive winxpSilver yuyo}
375+
set values $tablelist::treeStyles ;# dirty, but safe
392376
}
393377
}
394378

@@ -408,6 +392,7 @@ proc configTablelist {} {
408392
-autoscan -
409393
-customdragsource -
410394
-displayondemand -
395+
-editendonfocusout -
411396
-editselectedonly -
412397
-exportselection -
413398
-forceeditendcommand -
@@ -487,11 +472,10 @@ proc configTablelist {} {
487472
#
488473
# Set the scrollableframe's width, height, and yscrollincrement
489474
#
490-
update idletasks
475+
$sf autosize
491476
set rowHeight [expr {[winfo reqheight $cf] / $row}]
492477
set height [expr {10*$rowHeight + [winfo pixels .top 4p]}]
493-
$sf configure -width [winfo reqwidth $cf] -height $height \
494-
-yscrollincrement $rowHeight
478+
$sf configure -height $height -yscrollincrement $rowHeight
495479

496480
#
497481
# Create a ttk::button widget outside the scrollarea

0 commit comments

Comments
 (0)