Is there a way to place two text widgets in a paned window (yes, so
far), and bind them to the same scroll bar?
I tried this:
frame .t -bd 2 -relief sunken
panedwindow .t.t -orient vertical
# Here is the source text widget
########################################SOURCE TEXT WIDGET
.t.t add [text .t.t.source -yscrollcommand ".t.t.ys set" -wrap word -
maxundo 0 -undo true ]
# Here is the target text widget
###################################TARGET TEXT WIDGET
.t.t add [text .t.t.target -yscrollcommand ".t.t.ys set" -wrap word -
maxundo 0 -undo true ]
scrollbar .t.t.ys -command ".t.t.source yview"
pack .t.t.source -in .t.t -side left -fill both -expand true
pack .t.t.ys -in .t.t -side left -fill y
pack .t.t.target -in .t.t -side left -fill both -expand true
pack .t.t -in .t -fill both -expand true
pack .t -in . -fill both -expand true
But it doesn't seem to be working.
I figured giving them the same yscrollcommand would do it.
I'm trying to compare two texts (a source text and the translation
thereof), or open a source text and write in the translation, to join
the two files into
a .tmx or .xliff file.
Thanks,
Tony
--
http://www.baldwinlinguas.com
http://www.linguasos.org/bsoft/
On the other hand
you could "steal" most of your app from tkdiff
http://sourceforge.net/projects/tkdiff/
http://wiki.tcl.tk/3773
http://en.wikipedia.org/wiki/Tkdiff
It's got file loading and save,
a two pane syncronously scrollable textwidget
and should be a good start.
uwe
I'd be interested to hear how you propose to keep the texts visually
aligned, given invariable differences in length between the source
text and the translation.
Others have given more comprehensive answers, but this last line is the
source of the problem -- the scrollbar only alters one of the widget's
yview:
proc sendall {ws args} {
foreach w $ws { uplevel 1 $w $args }
}
set widgets {.t.t.source .t.t.target}
scrollbar .t.t.ys -command [list sendall $widgets yview]
-- Neil