home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.tcl
- Path: sparky!uunet!caen!spencer
- From: spencer@med.umich.edu (Spencer W. Thomas)
- Subject: Re: scrolling two lists
- Message-ID: <SPENCER.93Jan7140121@guraldi.med.umich.edu>
- Date: Thu, 07 Jan 93 14:01:21 EST
- Organization: University of Michigan
- In-Reply-To: news@choreo.ca's message of Tue, 05 Jan 1993 20:33:10 GMT
- References: <1993Jan05.203310.11620@choreo.ca>
- Nntp-Posting-Host: guraldi.itn.med.umich.edu
- Lines: 36
-
- In article <1993Jan05.203310.11620@choreo.ca> news@choreo.ca (Choreo NetNews Administration Account(Ottawa)) writes:
- > I have two listboxes which contain related information. When one list is
- > scrolled I want the other scrolled for the same motion. In addition, I want
- > to use only one scroll bar to control the two lists.
-
- Try this
-
- listbox .l1 -relief raised -yscroll {lscroll .l2}
- listbox .l2 -relief raised -yscroll {lscroll .l1}
- scrollbar .s -orient vertical -command {lview}
-
- # Scroll both listboxes from the scrollbar
- proc lview {where} {
- .l1 yview $where
- .l2 yview $where
- }
-
- # Scroll the other listbox and the scrollbar
- proc lscroll {what total window first last} {
- $what yview $first
- .s set $total $window $first $last
- }
-
-
- foreach l {a b c d e f g h i j k l m n o p} {
- .l1 insert end $l
- .l2 insert end $l
- }
-
- pack append . .l1 {left filly} .l2 {left filly} .s {left filly}
-
-
- --
- =Spencer W. Thomas | Info Tech and Networking, B1911 CFOB, 0704
- "Genome Informatician" | Univ of Michigan, Ann Arbor, MI 48109
- Spencer.W.Thomas@med.umich.edu | 313-747-2778, FAX 313-764-4133
-