📄 scrollbar.test
字号:
} {slider}test scrollbar-3.53 {ScrollbarWidgetCmd procedure, "identify" option} { .s identify 5 145} {trough2}test scrollbar-3.54 {ScrollbarWidgetCmd procedure, "identify" option} {unixOrPc} { .s identify 5 195} {arrow2}test scrollbar-3.55 {ScrollbarWidgetCmd procedure, "identify" option} {macOnly} { .s identify 5 195} {}test scrollbar-3.56 {ScrollbarWidgetCmd procedure, "identify" option} {unixOnly} { .s identify 0 0} {}test scrollbar-3.57 {ScrollbarWidgetCmd procedure, "set" option} { list [catch {.s set abc def} msg] $msg} {1 {expected floating-point number but got "abc"}}test scrollbar-3.58 {ScrollbarWidgetCmd procedure, "set" option} { list [catch {.s set 0.6 def} msg] $msg} {1 {expected floating-point number but got "def"}}test scrollbar-3.59 {ScrollbarWidgetCmd procedure, "set" option} { .s set -.2 .3 set result {} foreach element [.s get] { lappend result [format %.1f $element] } set result} {0.0 0.3}test scrollbar-3.60 {ScrollbarWidgetCmd procedure, "set" option} { .s set 1.1 .4 .s get} {1.0 1.0}test scrollbar-3.61 {ScrollbarWidgetCmd procedure, "set" option} { .s set .5 -.3 .s get} {0.5 0.5}test scrollbar-3.62 {ScrollbarWidgetCmd procedure, "set" option} { .s set .5 87 .s get} {0.5 1.0}test scrollbar-3.63 {ScrollbarWidgetCmd procedure, "set" option} { .s set .4 .3 set result {} foreach element [.s get] { lappend result [format %.1f $element] } set result} {0.4 0.4}test scrollbar-3.64 {ScrollbarWidgetCmd procedure, "set" option} { list [catch {.s set abc def ghi jkl} msg] $msg} {1 {expected integer but got "abc"}}test scrollbar-3.65 {ScrollbarWidgetCmd procedure, "set" option} { list [catch {.s set 1 def ghi jkl} msg] $msg} {1 {expected integer but got "def"}}test scrollbar-3.66 {ScrollbarWidgetCmd procedure, "set" option} { list [catch {.s set 1 2 ghi jkl} msg] $msg} {1 {expected integer but got "ghi"}}test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} { list [catch {.s set 1 2 3 jkl} msg] $msg} {1 {expected integer but got "jkl"}}test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} { .s set -10 50 20 30 .s get} {0 50 0 0}test scrollbar-3.69 {ScrollbarWidgetCmd procedure, "set" option} { .s set 100 -10 20 30 .s get} {100 0 20 30}test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} { .s set 100 50 30 20 .s get} {100 50 30 30}test scrollbar-3.71 {ScrollbarWidgetCmd procedure, "set" option} { list [catch {.s set 1 2 3} msg] $msg} {1 {wrong # args: should be ".s set firstFraction lastFraction" or ".s set totalUnits windowUnits firstUnit lastUnit"}}test scrollbar-3.72 {ScrollbarWidgetCmd procedure, "set" option} { list [catch {.s set 1 2 3 4 5} msg] $msg} {1 {wrong # args: should be ".s set firstFraction lastFraction" or ".s set totalUnits windowUnits firstUnit lastUnit"}}test scrollbar-3.73 {ScrollbarWidgetCmd procedure} { list [catch {.s bogus} msg] $msg} {1 {bad option "bogus": must be activate, cget, configure, delta, fraction, get, identify, or set}}test scrollbar-3.74 {ScrollbarWidgetCmd procedure} { list [catch {.s c} msg] $msg} {1 {bad option "c": must be activate, cget, configure, delta, fraction, get, identify, or set}}test scrollbar-4.1 {ScrollbarEventProc procedure} { catch {destroy .s1} scrollbar .s1 -bg #543210 rename .s1 .s2 set x {} lappend x [winfo exists .s1] lappend x [.s2 cget -bg] destroy .s1 lappend x [info command .s?] [winfo exists .s1] [winfo exists .s2]} {1 #543210 {} 0 0}test scrollbar-5.1 {ScrollbarCmdDeletedProc procedure} { catch {destroy .s1} scrollbar .s1 rename .s1 {} list [info command .s?] [winfo exists .s1]} {{} 0}catch {destroy .s}scrollbar .s -orient vertical -relief sunken -bd 2 -highlightthickness 2pack .s -side left -fill y.s set .2 .4updatetest scrollbar-6.1 {ScrollbarPosition procedure} {unixOnly} { .s identify 8 3} {}test scrollbar-6.2 {ScrollbarPosition procedure} {macOnly} { .s identify 8 3} {arrow1}test scrollbar-6.3 {ScrollbarPosition procedure} {macOrUnix} { .s identify 8 196} {}test scrollbar-6.4 {ScrollbarPosition procedure} {unixOnly} { .s identify 3 100} {}test scrollbar-6.5 {ScrollbarPosition procedure} {macOnly} { .s identify 3 100} {trough2}test scrollbar-6.6 {ScrollbarPosition procedure} {macOrUnix} { .s identify 19 100} {}test scrollbar-6.7 {ScrollbarPosition procedure} { .s identify [expr [winfo width .s] / 2] -1} {}test scrollbar-6.8 {ScrollbarPosition procedure} { .s identify [expr [winfo width .s] / 2] [expr [winfo height .s]]} {}test scrollbar-6.9 {ScrollbarPosition procedure} { .s identify -1 [expr [winfo height .s] / 2]} {}test scrollbar-6.10 {ScrollbarPosition procedure} { .s identify [winfo width .s] [expr [winfo height .s] / 2]} {}test scrollbar-6.11 {ScrollbarPosition procedure} {macOrUnix} { .s identify 8 4} {arrow1}test scrollbar-6.12 {ScrollbarPosition procedure} {unixOnly} { .s identify 8 19} {arrow1}test scrollbar-6.13 {ScrollbarPosition procedure} {macOnly} { .s identify 8 19} {trough1}test scrollbar-6.14 {ScrollbarPosition procedure} {pcOnly} { .s identify [expr [winfo width .s] / 2] 0 } {arrow1}test scrollbar-6.15 {ScrollbarPosition procedure} {pcOnly} { .s identify [expr [winfo width .s] / 2] [expr [testmetrics cyvscroll] - 1]} {arrow1}test scrollbar-6.16 {ScrollbarPosition procedure} {macOrUnix} { .s identify 8 20} {trough1}test scrollbar-6.17 {ScrollbarPosition procedure} {macOrUnix nonPortable} { # Don't know why this is non-portable, but it doesn't work on # some platforms. .s identify 8 51} {trough1}test scrollbar-6.18 {ScrollbarPosition procedure} {pcOnly} { .s identify [expr [winfo width .s] / 2] [testmetrics cyvscroll]} {trough1}test scrollbar-6.19 {ScrollbarPosition procedure} {pcOnly} { .s identify [expr [winfo width .s] / 2] [expr int(.2 / [.s delta 0 1]) \ + [testmetrics cyvscroll] - 1]} {trough1}test scrollbar-6.20 {ScrollbarPosition procedure} {macOrUnix} { .s identify 8 52} {slider}test scrollbar-6.21 {ScrollbarPosition procedure} {macOrUnix nonPortable} { # Don't know why this is non-portable, but it doesn't work on # some platforms. .s identify 8 83} {slider}test scrollbar-6.22 {ScrollbarPosition procedure} {pcOnly} { .s identify [expr [winfo width .s] / 2] [expr int(.2 / [.s delta 0 1]) \ + [testmetrics cyvscroll]]} {slider}test scrollbar-6.23 {ScrollbarPosition procedure} {pcOnly} { .s identify [expr [winfo width .s] / 2] [expr int(.4 / [.s delta 0 1]) \ + [testmetrics cyvscroll] - 1]} {slider}test scrollbar-6.24 {ScrollbarPosition procedure} {macOrUnix} { .s identify 8 84} {trough2}test scrollbar-6.25 {ScrollbarPosition procedure} {unixOnly} { .s identify 8 179} {trough2}test scrollbar-6.26 {ScrollbarPosition procedure} {macOnly} { .s identify 8 179} {arrow2}test scrollbar-6.27 {ScrollbarPosition procedure} {pcOnly} { .s identify [expr [winfo width .s] / 2] [expr int(.4 / [.s delta 0 1]) \ + [testmetrics cyvscroll]]} {trough2}test scrollbar-6.28 {ScrollbarPosition procedure} {pcOnly} { .s identify [expr [winfo width .s] / 2] [expr [winfo height .s] \ - [testmetrics cyvscroll] - 1]} {trough2}test scrollbar-6.29 {ScrollbarPosition procedure} {macOrUnix} { .s identify 8 180} {arrow2}test scrollbar-6.30 {ScrollbarPosition procedure} {unixOnly} { .s identify 8 195} {arrow2}test scrollbar-6.31 {ScrollbarPosition procedure} {macOnly} { .s identify 8 195} {}test scrollbar-6.32 {ScrollbarPosition procedure} {pcOnly} { .s identify [expr [winfo width .s] / 2] [expr [winfo height .s] \ - [testmetrics cyvscroll]]} {arrow2}test scrollbar-6.33 {ScrollbarPosition procedure} {pcOnly} { .s identify [expr [winfo width .s] / 2] [expr [winfo height .s] - 1]} {arrow2}test scrollbar-6.34 {ScrollbarPosition procedure} {macOrUnix} { .s identify 4 100} {trough2}test scrollbar-6.35 {ScrollbarPosition procedure} {unixOnly} { .s identify 18 100} {trough2}test scrollbar-6.36 {ScrollbarPosition procedure} {macOnly} { .s identify 18 100} {}test scrollbar-6.37 {ScrollbarPosition procedure} {pcOnly} { .s identify 0 100} {trough2}test scrollbar-6.38 {ScrollbarPosition procedure} {pcOnly} { .s identify [expr [winfo width .s] - 1] 100} {trough2}catch {destroy .t}toplevel .t -width 250 -height 150wm geometry .t +0+0scrollbar .t.s -orient horizontal -relief sunken -bd 2 -highlightthickness 2place .t.s -width 200.t.s set .2 .4updatetest scrollbar-6.39 {ScrollbarPosition procedure} {macOrUnix} { .t.s identify 4 8} {arrow1}test scrollbar-6.40 {ScrollbarPosition procedure} {pcOnly} { .t.s identify 0 [expr [winfo height .t.s] / 2]} {arrow1}test scrollbar-6.41 {ScrollbarPosition procedure} {unixOnly} { .t.s identify 82 8} {slider}test scrollbar-6.42 {ScrollbarPosition procedure} {macOnly} { .t.s identify 82 8} {}test scrollbar-6.43 {ScrollbarPosition procedure} {pcOnly} { .t.s identify [expr int(.4 / [.t.s delta 1 0]) + [testmetrics cxhscroll] \ - 1] [expr [winfo height .t.s] / 2] } {slider}test scrollbar-6.44 {ScrollbarPosition procedure} {unixOnly} { .t.s identify 100 18} {trough2}test scrollbar-6.45 {ScrollbarPosition procedure} {macOnly} { .t.s identify 100 18} {}test scrollbar-6.46 {ScrollbarPosition procedure} {pcOnly} { .t.s identify 100 [expr [winfo height .t.s] - 1]} {trough2}test scrollbar-7.1 {EventuallyRedraw} { .s configure -orient horizontal update set result [.s cget -orient] .s configure -orient vertical update lappend result [.s cget -orient]} {horizontal vertical}catch {destroy .t}toplevel .twm geometry .t +0+0test scrollbar-8.1 {TkScrollbarEventProc: recursive deletion} { proc doit {args} { destroy .t.f } proc bgerror {args} {} frame .t.f scrollbar .t.f.s -command doit pack .t.f -fill both -expand 1 pack .t.f.s -fill y -expand 1 -side right wm geometry .t 100x100 .t.f.s set 0 .5 update set result [winfo exists .t.f.s] event generate .t.f.s <ButtonPress> -button 1 -x [expr [winfo width .t.f.s] / 2] -y 5 update lappend result [winfo exists .t.f.s] [winfo exists .t.f] rename bgerror {} set result} {1 0 0}test scrollbar-8.2 {TkScrollbarEventProc: recursive deletion} { proc doit {args} { destroy .t.f.s } proc bgerror {args} {} frame .t.f scrollbar .t.f.s -command doit pack .t.f -fill both -expand 1 pack .t.f.s -fill y -expand 1 -side right wm geometry .t 100x100 .t.f.s set 0 .5 update set result [winfo exists .t.f.s] event generate .t.f.s <ButtonPress> -button 1 -x [expr [winfo width .t.f.s] / 2] -y 5 update lappend result [winfo exists .t.f.s] [winfo exists .t.f] rename bgerror {} set result} {1 0 1}set l [interp hidden]eval destroy [winfo children .]test scrollbar-9.1 {scrollbar widget vs hidden commands} { catch {destroy .s} scrollbar .s interp hide {} .s destroy .s list [winfo children .] [interp hidden]} [list {} $l]catch {destroy .s}catch {destroy .t}concat {}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -