Posted to tcl by aspect at Fri Nov 18 03:29:35 GMT 2016view raw
- package require Tk
 -  
 - pack [ttk::treeview .tree] -expand yes -fill both
 - pack [ttk::frame .buttons] -expand yes -fill both
 - grid [ttk::button .buttons.show -text "Show Errors" -command show_errors] \
 - 	 [ttk::button .buttons.hide -text "Hide Errors" -command hide_errors]
 -  
 - # error takes priority because it is created first
 - .tree tag configure error		;# even without any options
 - .tree tag configure funny -background blue
 -  
 - set br [.tree insert {} end -text "Funny" -tags {funny}]
 - set br [.tree insert {} end -text "Error" -tags {error}]
 - set rb [.tree insert {} end -text "Funny Error" -tags {funny error}]
 - set rb [.tree insert {} end -text "Not Even Funny"]
 -  
 -  
 - proc show_errors {} {
 - 	.tree tag configure error -background red
 - 	.buttons.show state disabled
 - 	.buttons.hide state !disabled
 - }
 -  
 - proc hide_errors {} {
 - 	.tree tag configure error -background ""
 - 	.buttons.show state !disabled
 - 	.buttons.hide state disabled
 - }
 -  
 - show_errors   ;# initialise tag options and buttons
 -