Scrolling two listboxes with one scrollbar? 
Author Message
 Scrolling two listboxes with one scrollbar?

I'm trying to link a scrollbar to two or more listboxes.  I've just
started with TCL, and would put:
scrollbar .scrollv -command ".listbox yview"

But what should the command be for two listboxes?

Thanks! Please e-mail responses.
Chris Sidi

P.S. The only thing I came up with is to make a procedure to bounce
the scroll bar value to the two listboxes:

proc two_yviews {value} {
        .mon yview $value
        .tue yview $value
        }

scrollbar .scrollv -orient vertical -command "two_yviews"
pack .scrollv -side right -fill y

listbox .mon -yscrollcommand ".scrollv set"
listbox .tue -yscrollcommand ".scrollv set"
pack .mon .tue -side left



Sun, 27 Dec 1998 03:00:00 GMT  
 Scrolling two listboxes with one scrollbar?

Hi

Chris Sidi asked:

Quote:
> I'm trying to link a scrollbar to two or more listboxes.  I've just
> started with TCL, and would put:
> scrollbar .scrollv -command ".listbox yview"

> But what should the command be for two listboxes?


from homepage <http://r8h.cs.man.ac.uk:8000/tcl/>

The bit that helps most is:

pack    [listbox .1 -exportselection 0 -takefocus 0 \
                -yscrollcommand LBscroll -width 3] \
        [listbox .2 -exportselection 0 -takefocus 0 \
                 -yscrollcommand LBscroll -width 12] \
        [listbox .3 -exportselection 0 -takefocus 0 \
                -yscrollcommand LBscroll -width 5] \
        [listbox .4 -exportselection 0 -takefocus 0 \  
                -yscrollcommand LBscroll -width 12] \
        -side left -expand 1 -fill both
pack [scrollbar .sb -command {LBset yview}] -side left -fill y
set listboxes {.1 .2 .3 .4}

# Perform operation on all
proc LBset args {
    global listboxes
    foreach lb $listboxes {
        eval $lb $args
    }

Quote:
}

# Link for scanning (and partially from the keyboard)
proc LBscroll args {
    eval .sb set $args
    LBset yview moveto [lindex $args 0]

Quote:
}

Cheers
Neil


Sun, 27 Dec 1998 03:00:00 GMT  
 Scrolling two listboxes with one scrollbar?

: I'm trying to link a scrollbar to two or more listboxes.  I've just
: started with TCL, and would put:
: scrollbar .scrollv -command ".listbox yview"

: But what should the command be for two listboxes?

: P.S. The only thing I came up with is to make a procedure to bounce
: the scroll bar value to the two listboxes:

There is no built in way of creating multiple/linked scrollbars.  Your
solution is the way to go.

Geoff Mottram



Tue, 29 Dec 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

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

2. help with scrolling two listboxes by the single scrollbar

3. Scrolling two different widgets will one scrollbar

4. One Scrollbar for two listboxes??

5. one scrollbar for two listboxes?

6. one scrollbar for two listboxes?

7. Two listboxes, one vert scrollbar

8. SYNCHRONIZED SCROLLING, or, ONE SCROLLBAR TO SCROLL 2CanvasesWindows

9. ListBox / ScrollBar: Fire Event on Scroll

10. Scroll multiple windows with one scrollbar ?

11. scrolling multiple windows with one scrollbar

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

 

 
Powered by phpBB® Forum Software