Posted to tcl by saedelaere at Fri Feb 20 19:40:11 GMT 2009view raw

  1. $mf.t_top_newsr insert end "$update_news\n"
  2. set search_index 0.0
  3. foreach tag_word [split $word_tags] {
  4. if {[string trim $tag_word] == {}} continue
  5. set index [$mf.t_top_newsr search -exact $tag_word $search_index end]
  6. set word_length [string length $tag_word]
  7. set index2 "$index + $word_length char"
  8. $mf.t_top_newsr tag add underline "$index wordstart" "$index2"
  9. }
  10. $mf.t_top_newsr configure -state disabled

Comments

Posted by as at Sat Feb 21 00:45:58 GMT 2009 [text] [code]

Simplified test case, WFM: --- % package require Tk 8.5.6 % pack [text .t] % .t insert end "Please" normal "underline" underline "me" normal % .t tag configure underline -underline true --- Results: the text "underline" shows up underlined, as expected.