Posted to tcl by wil2k at Tue Mar 24 11:43:58 GMT 2020view raw
- itcl::body ::hwtk::widget::HWHintEntry::UpdateTreeItems {str icur} {
- update idletasks
- $itk_component(htree) item delete all
- ::set Priv(categoryBlocks) [dict create]
- if {[catch {
- ::set endIdx "end"
- if {[hwtk::validate::int $itk_option(-maxrows)] && $itk_option(-maxrows) > 0} {
- ::set endIdx [expr {$itk_option(-maxrows) - 1}]
- }
- ::set i 0
- update idletasks
- foreach {category valuelist} [{*}$itk_option(-values) $str $icur] {
- foreach valuesdata $valuelist {
- if {$i <= $endIdx} {
- if {$category eq "history"} {
- ::set hist [hwtk::image cache toolbarRecentHistory-16.png]
- #Valuesdata can be strings with \{
- ::set idx [$itk_component(htree) item create -values [list $Priv(elemHistory) $hist $Priv(elemName) $valuesdata hidden_text "history" ]]
- } elseif {$category eq "values"} {
- ::set val [dict get $valuesdata -value]
- ::set img ""
- if {[dict exists $valuesdata -image]} {
- ::set img [dict get $valuesdata -image]
- }
- ::set idx [$itk_component(htree) item create -values [list $Priv(elemHistory) $img $Priv(elemName) $val hidden_text "non-history" ]]
- } else {
- ::set idx [$itk_component(htree) item create -values [list $Priv(elemHistory) "" $Priv(elemName) $valuesdata hidden_text "non-history" ]]
- }
- incr i
- } else {
- break
- }
- }
- dict set Priv(categoryBlocks) $category $i
- if {$i == $endIdx} {
- break
- }
- }
- ConfigWarning "hide"
- } errMsg]} {
- ConfigWarning "show"
- }
- }