📄 listbox.test
字号:
} {el11}test listbox-10.7 {GetListboxIndex procedure} { .l delete 0 end .l index end} 0.l delete 0 end.l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11updatetest listbox-10.8 {GetListboxIndex procedure} { list [catch {.l index @} msg] $msg} {1 {bad listbox index "@": must be active, anchor, end, @x,y, or a number}}test listbox-10.9 {GetListboxIndex procedure} { list [catch {.l index @foo} msg] $msg} {1 {bad listbox index "@foo": must be active, anchor, end, @x,y, or a number}}test listbox-10.10 {GetListboxIndex procedure} { list [catch {.l index @1x3} msg] $msg} {1 {bad listbox index "@1x3": must be active, anchor, end, @x,y, or a number}}test listbox-10.11 {GetListboxIndex procedure} { list [catch {.l index @1,} msg] $msg} {1 {bad listbox index "@1,": must be active, anchor, end, @x,y, or a number}}test listbox-10.12 {GetListboxIndex procedure} { list [catch {.l index @1,foo} msg] $msg} {1 {bad listbox index "@1,foo": must be active, anchor, end, @x,y, or a number}}test listbox-10.13 {GetListboxIndex procedure} { list [catch {.l index @1,2x} msg] $msg} {1 {bad listbox index "@1,2x": must be active, anchor, end, @x,y, or a number}}test listbox-10.14 {GetListboxIndex procedure} {fonts} { list [.l index @5,57] [.l index @5,58]} {3 3}test listbox-10.15 {GetListboxIndex procedure} { list [catch {.l index 1xy} msg] $msg} {1 {bad listbox index "1xy": must be active, anchor, end, @x,y, or a number}}test listbox-10.16 {GetListboxIndex procedure} { .l index 3} {3}test listbox-10.17 {GetListboxIndex procedure} { .l index 20} {20}test listbox-10.18 {GetListboxIndex procedure} { .l get 20} {}test listbox-10.19 {GetListboxIndex procedure} { .l index -2} -2test listbox-10.20 {GetListboxIndex procedure} { .l delete 0 end .l index 1} 1test listbox-11.1 {ChangeListboxView procedure, boundary conditions for index} { catch {destroy .l} listbox .l -height 5 pack .l .l insert 0 a b c d e f g h i j .l yview 3 update set x [.l index @0,0] .l yview -1 update lappend x [.l index @0,0]} {3 0}test listbox-11.2 {ChangeListboxView procedure, boundary conditions for index} { catch {destroy .l} listbox .l -height 5 pack .l .l insert 0 a b c d e f g h i j .l yview 3 update set x [.l index @0,0] .l yview 20 update lappend x [.l index @0,0]} {3 5}test listbox-11.3 {ChangeListboxView procedure} { catch {destroy .l} listbox .l -height 5 -yscrollcommand "record y" pack .l .l insert 0 a b c d e f g h i j update set log {} .l yview 2 update list [.l yview] $log} {{0.2 0.7} {{y 0.2 0.7}}}test listbox-11.4 {ChangeListboxView procedure} { catch {destroy .l} listbox .l -height 5 -yscrollcommand "record y" pack .l .l insert 0 a b c d e f g h i j update set log {} .l yview 8 update list [.l yview] $log} {{0.5 1} {{y 0.5 1}}}test listbox-11.5 {ChangeListboxView procedure} { catch {destroy .l} listbox .l -height 5 -yscrollcommand "record y" pack .l .l insert 0 a b c d e f g h i j .l yview 3 update set log {} .l yview 3 update list [.l yview] $log} {{0.3 0.8} {}}test listbox-11.6 {ChangeListboxView procedure, partial last line} { mkPartial .partial.l yview 13 .partial.l index @0,0} {11}catch {destroy .l}listbox .l -font $fixed -xscrollcommand "record x" -width 10.l insert 0 0123456789a123456789b123456789c123456789d123456789e123456789f123456789g123456789h123456789i123456789pack .lupdatetest listbox-12.1 {ChangeListboxOffset procedure} {fonts} { set log {} .l xview 99 update list [.l xview] $log} {{0.9 1} {{x 0.9 1}}}test listbox-12.2 {ChangeListboxOffset procedure} {fonts} { set log {} .l xview moveto -.25 update list [.l xview] $log} {{0 0.1} {{x 0 0.1}}}test listbox-12.3 {ChangeListboxOffset procedure} {fonts} { .l xview 10 update set log {} .l xview 10 update list [.l xview] $log} {{0.1 0.2} {}}catch {destroy .l}listbox .l -font $fixed -width 10 -height 5pack .l.l insert 0 a bb c d e f g h i j k l m n o p q r s.l insert 0 0123456789a123456789b123456789c123456789d123456789updateset width [expr [lindex [.l bbox 2] 2] - [lindex [.l bbox 1] 2]]set height [expr [lindex [.l bbox 2] 1] - [lindex [.l bbox 1] 1]]test listbox-13.1 {ListboxScanTo procedure} {fonts} { .l yview 0 .l xview 0 .l scan mark 10 20 .l scan dragto [expr 10-$width] [expr 20-$height] update list [.l xview] [.l yview]} {{0.2 0.4} {0.5 0.75}}test listbox-13.2 {ListboxScanTo procedure} {fonts} { .l yview 5 .l xview 10 .l scan mark 10 20 .l scan dragto 20 40 update set x [list [.l xview] [.l yview]] .l scan dragto [expr 20-$width] [expr 40-$height] update lappend x [.l xview] [.l yview]} {{0 0.2} {0 0.25} {0.2 0.4} {0.5 0.75}}test listbox-13.3 {ListboxScanTo procedure} {fonts} { .l yview moveto 1.0 .l xview moveto 1.0 .l scan mark 10 20 .l scan dragto 5 10 update set x [list [.l xview] [.l yview]] .l scan dragto [expr 5+$width] [expr 10+$height] update lappend x [.l xview] [.l yview]} {{0.8 1} {0.75 1} {0.62 0.82} {0.25 0.5}}test listbox-14.1 {NearestListboxElement procedure, partial last line} { mkPartial .partial.l nearest [winfo height .partial.l]} {4}catch {destroy .l}listbox .l -font $fixed -width 20 -height 10.l insert 0 a b c d e f g h i j k l m n o p q r s t.l yview 4pack .lupdatetest listbox-14.2 {NearestListboxElement procedure} {fonts} { .l index @50,0} {4}test listbox-14.3 {NearestListboxElement procedure} {fonts} { list [.l index @50,35] [.l index @50,36]} {5 6}test listbox-14.4 {NearestListboxElement procedure} {fonts} { .l index @50,200} {13}test listbox-15.1 {ListboxSelect procedure} { .l delete 0 end .l insert 0 a b c d e f g h i j k l m n o p .l select set 2 4 .l select set 7 12 .l select clear 4 7 .l curselection} {2 3 8 9 10 11 12}test listbox-15.2 {ListboxSelect procedure} { .l delete 0 end .l insert 0 a b c d e f g h i j k l m n o p catch {destroy .e} entry .e .e insert 0 "This is some text" .e select from 0 .e select to 7 .l selection clear 2 4 set x [selection own] .l selection set 3 list $x [selection own] [selection get]} {.e .l d}test listbox-15.3 {ListboxSelect procedure} { .l delete 0 end .l selection clear 0 end .l select set 0 end .l curselection} {}test listbox-15.4 {ListboxSelect procedure, boundary conditions for indices} { .l delete 0 end .l insert 0 a b c d e f .l select clear 0 end .l select set -2 -1 .l curselection} {}test listbox-15.5 {ListboxSelect procedure, boundary conditions for indices} { .l delete 0 end .l insert 0 a b c d e f .l select clear 0 end .l select set -1 3 .l curselection} {0 1 2 3}test listbox-15.6 {ListboxSelect procedure, boundary conditions for indices} { .l delete 0 end .l insert 0 a b c d e f .l select clear 0 end .l select set 2 4 .l curselection} {2 3 4}test listbox-15.7 {ListboxSelect procedure, boundary conditions for indices} { .l delete 0 end .l insert 0 a b c d e f .l select clear 0 end .l select set 4 end .l curselection} {4 5}test listbox-15.8 {ListboxSelect procedure, boundary conditions for indices} { .l delete 0 end .l insert 0 a b c d e f .l select clear 0 end .l select set 4 30 .l curselection} {4 5}test listbox-15.9 {ListboxSelect procedure, boundary conditions for indices} { .l delete 0 end .l insert 0 a b c d e f .l select clear 0 end .l select set end 30 .l curselection} {5}test listbox-15.10 {ListboxSelect procedure, boundary conditions for indices} { .l delete 0 end .l insert 0 a b c d e f .l select clear 0 end .l select set 20 25 .l curselection} {}test listbox-16.1 {ListboxFetchSelection procedure} { .l delete 0 end .l insert 0 a b c "two words" e f g h i \\ k l m n o p .l selection set 2 4 .l selection set 9 .l selection set 11 12 selection get} "c\ntwo words\ne\n\\\nl\nm"test listbox-16.2 {ListboxFetchSelection procedure} { .l delete 0 end .l insert 0 a b c "two words" e f g h i \\ k l m n o p .l selection set 3 selection get} "two words"test listbox-16.3 {ListboxFetchSelection procedure, retrieve in several parts} { set long "This is quite a long string\n" append long $long $long $long $long append long $long $long $long $long append long $long $long .l delete 0 end .l insert 0 1$long 2$long 3$long 4$long 5$long .l selection set 0 end set sel [selection get] string compare 1$long\n2$long\n3$long\n4$long\n5$long $sel} {0}catch {unset long sel}test listbox-17.1 {ListboxLostSelection procedure} { .l delete 0 end .l insert 0 a b c d e .l select set 0 end catch {destroy .e} entry .e .e insert 0 "This is some text" .e select from 0 .e select to 5 .l curselection} {}test listbox-17.2 {ListboxLostSelection procedure} { .l delete 0 end .l insert 0 a b c d e .l select set 0 end .l configure -exportselection 0 catch {destroy .e} entry .e .e insert 0 "This is some text" .e select from 0 .e select to 5 .l curselection} {0 1 2 3 4}catch {destroy .l}listbox .l -font $fixed -width 10 -height 5pack .lupdatetest listbox-18.1 {ListboxUpdateVScrollbar procedure} { .l configure -yscrollcommand "record y" set log {} .l insert 0 a b c update .l insert end d e f g h update .l delete 0 end update set log} {{y 0 1} {y 0 0.625} {y 0 1}}test listbox-18.2 {ListboxUpdateVScrollbar procedure, partial last line} { mkPartial .partial.l configure -yscrollcommand "record y" set log {} .partial.l yview 3 update set log} {{y 0.2 0.466667}}test listbox-18.3 {ListboxUpdateVScrollbar procedure} { proc bgerror args { global x errorInfo set x [list $args $errorInfo] } .l configure -yscrollcommand gorp .l insert 0 foo update set x} {{{invalid command name "gorp"}} {invalid command name "gorp" while executing"gorp 0 1" (vertical scrolling command executed by listbox)}}if {[info exists bgerror]} { rename bgerror {}}catch {destroy .l}listbox .l -font $fixed -width 10 -height 5pack .lupdatetest listbox-19.1 {ListboxUpdateVScrollbar procedure} {fonts} { .l configure -xscrollcommand "record x" set log {} .l insert 0 abc update .l insert 0 "This is a much longer string..." update .l delete 0 end update set log} {{x 0 1} {x 0 0.322581} {x 0 1}}test listbox-19.2 {ListboxUpdateVScrollbar procedure} { proc bgerror args { global x errorInfo set x [list $args $errorInfo] } .l configure -xscrollcommand bogus .l insert 0 foo update set x} {{{invalid command name "bogus"}} {invalid command name "bogus" while executing"bogus 0 1" (horizontal scrolling command executed by listbox)}}set l [interp hidden]eval destroy [winfo children .]test listbox-20.1 {listbox vs hidden commands} { catch {destroy .l} listbox .l interp hide {} .l destroy .l list [winfo children .] [interp hidden]} [list {} $l]resetGridInfocatch {destroy .l2}catch {destroy .t}catch {destroy .e}catch {destroy .partial}option clear
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -