Posted to tcl by patthoyts at Thu May 08 21:52:11 GMT 2008view raw

  1. namespace eval xyzzy {
  2. ::ttk::style layout ChoosefontFrame {
  3. Entry.field -sticky news -border true -children {
  4. ChoosefontFrame.padding -sticky news
  5. }
  6. }
  7. bind [winfo class .] <<ThemeChanged>> \
  8. [list ttk::style layout ChoosefontFrame \
  9. [ttk::style layout ChoosefontFrame]]
  10. }
  11.  
  12. # ::xyzzy::ttk_listbox --
  13. #
  14. # Create a properly themed scrolled listbox.
  15. # This is exactly right on XP but may need adjusting on other platforms.
  16. #
  17. proc ::xyzzy::ttk_slistbox {w args} {
  18. set f [ttk::frame $w -style ChoosefontFrame -padding 2]
  19. if {[catch {
  20. listbox $f.list -relief flat -highlightthickness 0 -borderwidth 0 {*}$args
  21. ttk::scrollbar $f.vs -command [list $f.list yview]
  22. $f.list configure -yscrollcommand [list $f.vs set]
  23. grid $f.list $f.vs -sticky news
  24. grid rowconfigure $f 0 -weight 1
  25. grid columnconfigure $f 0 -weight 1
  26. interp hide {} $w
  27. interp alias {} $w {} $f.list
  28. } err]} {
  29. destroy $f
  30. return -code error $err
  31. }
  32. return $w
  33. }