home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / tcl / 2336 < prev    next >
Encoding:
Text File  |  1993-01-11  |  2.0 KB  |  58 lines

  1. Newsgroups: comp.lang.tcl,bnr.lang.tcl
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!nott!bnrgate!bcars6a8!bnr.ca!norm
  3. From: norm@bnr.ca (Norm MacNeil)
  4. Subject: Dual box scrolling
  5. Message-ID: <1993Jan11.192403.28728@bcars6a8.bnr.ca>
  6. Sender: usenet@bcars6a8.bnr.ca (Use Net)
  7. Nntp-Posting-Host: bcarh1ff
  8. Reply-To: norm@bnr.ca
  9. Organization: Bell-Northern Research Ltd.
  10. Date: Mon, 11 Jan 1993 19:24:03 GMT
  11. Lines: 45
  12.  
  13. I remember someone posting about how to allow for dual-box scrolling; e.g.,
  14. with spreadsheets, you can "lock" a row or column to remain in place while
  15. you scroll around.  I did the same for a scrolling "header" basically by
  16.  
  17. ---
  18. frame .frame
  19. scrollbar .frame.listbox.ysb -command ".frame.listbox.box yview"
  20. scrollbar .frame.listbox.xsb -orient horizontal -command "dualajust"
  21. listbox .frame.listbox.hdr -geometry 40x2 -xscrollcommand \
  22.   ".frame.listbox.xsb set"
  23. listbox .frame.listbox.box -yscrollcommand ".frame.listbox.ysb set" \
  24.   -xscrollcommand ".frame.listbox.xsb set"
  25. pack append .frame \
  26.   .frame.listbox.xsb {bottom fillx} \
  27.   .frame.listbox.ysb {left filly} \
  28.   .frame.listbox.hdr {expand fill} \
  29.   .frame.listbox.box {expand fill}
  30.  
  31. proc dualajust {n} {
  32.   global .frame.listbox.hdr .frame.listbox.box
  33.   .frame.listbox.hdr xview $n
  34.   .frame.listbox.box xview $n
  35. }
  36.  
  37. ---
  38.  
  39. The only problem I have is that I have to have this extra procedure to scroll
  40. both areas.  Is there a "variable" like in bind to substitute in the value that
  41. is passed to "dualadjust"; e.g.,
  42.  
  43.   scrollbar .frame.listbox.xsb -orient horizontal \
  44.     -command ".frame.listbox.hdr xview %x; .frame.listbox.box xview %x"
  45.  
  46. or some such beast.
  47.  
  48. Any thoughts?
  49.  
  50. Thanks,
  51.   Norm.
  52.  
  53. +-----------------------------------------------------------------------+
  54.  Norm MacNeil                     Phone: (613) 763-3372
  55.  Data Systems                     Fax:   (613) 765-2854
  56.  Bell-Northern Research Ltd.      EMail: norm@bnr.ca (INTERNET)
  57.  #include <disclaimer.std>       "Roller bladers do it in-line!"
  58.