Multiple listbox control with one scrollbar 
Author Message
 Multiple listbox control with one scrollbar

Quote:

>how can I make the scrollbar
>control the vertical movement of all the listboxes?

Repeat number two of earlier post: (this also handles mouse selection)

proc LBset args {
        foreach lb {.1 .2 .3} {
                eval $lb $args
        }

Quote:
}

proc LBscroll args {
        eval .sy set $args
        LBset yview moveto [lindex $args 0]

Quote:
}

listbox .1 -export no -selectmode browse -yscrollcom LBscroll
listbox .2 -export no -selectmode browse -yscrollcom LBscroll
listbox .3 -export no -selectmode browse -yscrollcom LBscroll
pack .1 .2 .3 -side left -fill both -expand 1

scrollbar .sy -orient v -command "LBset yview"
pack .sy -fill y -side right

for {set i 25} {$i} {incr i -1} {LBset insert end $i}

foreach lb {.1 .2 .3} {
        bind $lb <ButtonPress-1> {
                LBset select clear 0 end
                LBset select set [%W nearest %y]
        }
        bind $lb <B1-Motion> {
                LBset select clear 0 end
                LBset select set [%W nearest %y]
        }
        bind $lb <ButtonRelease-1> {
                LBset select clear 0 end
                LBset select set [%W nearest %y]
        }

Quote:
}

That should work OK.  You can take out the B1-Motion binding to reduce the
number of events, but then the behavior, while still giving the same
results, is a little weird.  Tell me if something doesn't work.  You should
even be able to resize everything.

Maybe you should forward this to the FAQ...
--
     Jeffrey Hobbs                           Office: 541/346-3998

                URL: http://www.*-*-*.com/ ~jhobbs/



Tue, 18 Aug 1998 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Scrollbar controlling multiple listboxes

2. Join several listboxes to one scrollbar...

3. One Scrollbar for two listboxes??

4. one scrollbar for two listboxes?

5. one scrollbar for two listboxes?

6. multiple listboxes (with -selectmode extended) bound to a single scrollbar

7. linking multiple listboxes with a scrollbar

8. Scrolling two listboxes with one scrollbar?

9. Multi listbox, one scrollbar

10. 2 or more listboxes listening to one scrollbar ?

11. Two listboxes, one vert scrollbar

12. How can I control a ListBox scrollbar?

 

 
Powered by phpBB® Forum Software