one scrollbar for two listboxes? 
Author Message
 one scrollbar for two listboxes?

Quote:

> Hi,

> I want to create two listboxes with different content where each line
> belongs together (like in the example A-1, B-2 ..)
> So I want the scrollbar to scroll both listboxes simultaneous. Unfortunately
> it only scrolls the listbox which is the last in the command (.b) When I use
> MouseButton 2 in every list they manipulate the scrollbar as expected.
> Please, could you correct my example, that it does the expected scrolling?

Tonight I wrote some code that does this.

proc dual {args} \
{
#Let's see what we have.
puts $args
        if {[llength $args] == 2} \
        {
        .f.l1 yview moveto [lindex $args 1]
        .f.l2 yview moveto [lindex $args 1]
        }

        if {[llength $args] == 3} \
        {
        .f.l1 yview scroll [lindex $args 1] units
        .f.l2 yview scroll [lindex $args 1] units
        }

#Why doesn't this work?
#.f.l1 yview $args
#.f.l2 yview $args

Quote:
}

pack [frame .f]
pack [listbox .f.l1 -yscrollcommand {.f.s set}] -side left
pack [listbox .f.l2 -yscrollcommand {.f.s set}] -side left
pack [scrollbar .f.s -command {dual}] -side right -fill y

for {set i 0} {$i < 30} {incr i 1} \
{
.f.l1 insert end $i
.f.l2 insert end $i

Quote:
}
> ---

> cIao
> Mat

--
----------------------------------
George Peter Staplin
http://www.*-*-*.com/ ~georgeps/
----------------------------------


Sun, 19 Jan 2003 03:00:00 GMT  
 one scrollbar for two listboxes?
Quote:
> Tonight I wrote some code that does this.

thanks alot

cIao
Mat



Mon, 20 Jan 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. One Scrollbar for two listboxes??

2. one scrollbar for two listboxes?

3. Scrolling two listboxes with one scrollbar?

4. Two listboxes, one vert scrollbar

5. Two canvas scrolled simultaneously by the same scrollbar (an UNIQUE scrollbar and TWO or more canvas)

6. help with scrolling two listboxes by the single scrollbar

7. Two canvases (widgets), one scrollbar..

8. Join several listboxes to one scrollbar...

9. Scrolling two different widgets will one scrollbar

10. How to use one scrollbar to control two text widgets

11. Synchronizing two text- widgets to one scrollbar ?

12. Multiple listbox control with one scrollbar

 

 
Powered by phpBB® Forum Software