Tk Source Code

Artifact [f4fab874]
Login

Artifact f4fab8740cb2def8b55bacf0224c5e0345c8f566:

Attachment "tw2.tcl" to ticket [1501749f] added by pcmacdon 2006-06-06 23:56:33.
# Demonstrate TEXT using a window frame as placeholder for 
# a section rendering.  When window gets mapped, it's
# deleted and the section gets rendered.
set str [string repeat "The quick red fox jumped over the lazy brown dog\n" 100]
pack [text .t] -fill both -expand y -side left
pack [scrollbar .sb -command ".t yview"] -fill y -side left
.t conf -yscrollc ".sb set"
.t insert end $str\n
.t window create end -window [frame .f1 -width 800 -height 800]
.t insert end \n$str
.t tag conf foo -background lightblue
proc MAPPED w {
  puts "MAPPED"
  set i [.t index $w]
  set oi [.t index @0,0]
  .t delete $w
  destroy $w
  .t insert $i [string toupper $::str] foo
  .t mark set insert $oi
  .t see $oi
}
bind .f1 <Map> "MAPPED %W"
focus .t