Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scrollbar

Status
Not open for further replies.

akpr

Programmer
Jul 25, 2001
19
US
How it is assigned one scrollbar with 2 text at same time
ie
i have 2 text widget
one for displaying text and another for displaying number

Text1 Text2
1 aaaa
2 bbbb
3 5555
I want to configure the scrollbar with these texts in such a way that if u scroll both text should get scrolled
i tried the following way but it does not work
text $LinePath -relief raised -width 5 -yscrollcommand "$ScrollPath set"
text $sourcedisplay -relief raised -yscrollcommand "$ScrollPath set"

Configure scrollbar
$ScrollPath configure -command "$sourcedisplay yview"
$ScrollPath configure -command "$LinePath yview"


 
The second $ScrollPath configure -command replaces the first.
You need to define a proc.

This works :

text .t1 -relief raised -width 5 -height 5 -yscrollcommand ".sb set"
text .t2 -relief raised -width 5 -height 5 -yscrollcommand ".sb set"
foreach n {1 2 3 4 5 6 7} {.t1 insert end $n\n }
foreach n {1 2 3 4 5 6 7} {.t2 insert end $n\n }
scrollbar .sb -orient vertical -command yview
proc yview {args} { eval .t1 yview $args; eval .t2 yview $args }
pack .t1 -side left
pack .t2 -side left
pack .sb -side left -fill y

ulis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top