Posted to tcl by wil2k at Tue Mar 24 11:43:58 GMT 2020view raw

  1. itcl::body ::hwtk::widget::HWHintEntry::UpdateTreeItems {str icur} {
  2. update idletasks
  3. $itk_component(htree) item delete all
  4. ::set Priv(categoryBlocks) [dict create]
  5.  
  6. if {[catch {
  7. ::set endIdx "end"
  8. if {[hwtk::validate::int $itk_option(-maxrows)] && $itk_option(-maxrows) > 0} {
  9. ::set endIdx [expr {$itk_option(-maxrows) - 1}]
  10. }
  11.  
  12. ::set i 0
  13. update idletasks
  14. foreach {category valuelist} [{*}$itk_option(-values) $str $icur] {
  15. foreach valuesdata $valuelist {
  16. if {$i <= $endIdx} {
  17. if {$category eq "history"} {
  18. ::set hist [hwtk::image cache toolbarRecentHistory-16.png]
  19. #Valuesdata can be strings with \{
  20. ::set idx [$itk_component(htree) item create -values [list $Priv(elemHistory) $hist $Priv(elemName) $valuesdata hidden_text "history" ]]
  21. } elseif {$category eq "values"} {
  22. ::set val [dict get $valuesdata -value]
  23. ::set img ""
  24. if {[dict exists $valuesdata -image]} {
  25. ::set img [dict get $valuesdata -image]
  26. }
  27. ::set idx [$itk_component(htree) item create -values [list $Priv(elemHistory) $img $Priv(elemName) $val hidden_text "non-history" ]]
  28. } else {
  29. ::set idx [$itk_component(htree) item create -values [list $Priv(elemHistory) "" $Priv(elemName) $valuesdata hidden_text "non-history" ]]
  30. }
  31. incr i
  32. } else {
  33. break
  34. }
  35. }
  36.  
  37. dict set Priv(categoryBlocks) $category $i
  38.  
  39. if {$i == $endIdx} {
  40. break
  41. }
  42. }
  43. ConfigWarning "hide"
  44. } errMsg]} {
  45. ConfigWarning "show"
  46. }
  47. }
  48.