Tk Source Code

Check-in [b072a081]
Login

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

Overview
Comment:Fix [368fa4561e]: ttk::treeview open/closed indicators can be toggled while hidden
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b072a0815b34e44d78a707395311dfcffaa6a9613f39233ee9334762ad04516a
User & Date: fvogel 2019-04-19 09:15:09
Context
2019-04-19
14:41
Fine tune aqua ttk colors. Fix availability errors introduced in 6cafd6f7. check-in: 21e61e00 user: culler tags: trunk
13:10
merge trunk check-in: 8570a507 user: fvogel tags: revised_text, tip-466
09:15
Fix [368fa4561e]: ttk::treeview open/closed indicators can be toggled while hidden check-in: b072a081 user: fvogel tags: trunk
09:13
Fix [368fa4561e]: ttk::treeview open/closed indicators can be toggled while hidden check-in: 785e2cdd user: fvogel tags: core-8-6-branch
00:13
Some things must be conditionally compiled. Really. check-in: 6cafd6f7 user: dkf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to library/ttk/treeview.tcl.

332
333
334
335
336
337
338






339
340
341
342
343
344
345
    $w focus $item
    event generate $w <<TreeviewClose>>
}

## Toggle -- toggle opened/closed state of item
#
proc ttk::treeview::Toggle {w item} {






    if {[$w item $item -open]} {
	CloseItem $w $item
    } else {
	OpenItem $w $item
    }
}








>
>
>
>
>
>







332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
    $w focus $item
    event generate $w <<TreeviewClose>>
}

## Toggle -- toggle opened/closed state of item
#
proc ttk::treeview::Toggle {w item} {
    # don't allow toggling on indicators that
    # are not present in front of leaf items
    if {[$w children $item] == {}} {
        return
    }
    # not a leaf, toggle!
    if {[$w item $item -open]} {
	CloseItem $w $item
    } else {
	OpenItem $w $item
    }
}

Changes to tests/ttk/treeview.test.

631
632
633
634
635
636
637

















638
639
} -body {
    set item [.tv insert {} end]
    .tv tag remove foo $item
    .tv item $item -tags
} -cleanup {
    destroy .tv
} -result [list]


















tcltest::cleanupTests







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


631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
} -body {
    set item [.tv insert {} end]
    .tv tag remove foo $item
    .tv item $item -tags
} -cleanup {
    destroy .tv
} -result [list]

test treeview-368fa4561e "indicators cannot be clicked on leafs" -setup {
    pack [ttk::treeview .tv]
    .tv insert {} end -id foo -text "<-- (1) Click the blank space to my left" 
    update
} -body {
    foreach {x y w h} [.tv bbox foo #0] {}
    set res [.tv item foo -open]
    # using $h even for x computation is intentional here in order to simulate
    # a mouse click on the (invisible since we're on a leaf) indicator
    event generate .tv <ButtonPress-1> \
            -x [expr ($x + $h / 2)] \
            -y [expr ($y + $h / 2)]
    lappend res [.tv item foo -open]
    .tv insert foo end -text "sub"
    lappend res [.tv item foo -open]
} -result {0 0 0}

tcltest::cleanupTests