Hex Artifact Content
Not logged in

Artifact 6141ef94660efd146a88e24bcd96666feedad11b:


0000: 23 20 2d 2a 2d 20 6d 6f 64 65 3a 20 54 43 4c 3b  # -*- mode: TCL;
0010: 20 66 69 6c 6c 2d 63 6f 6c 75 6d 6e 3a 20 37 35   fill-column: 75
0020: 3b 20 74 61 62 2d 77 69 64 74 68 3a 20 38 3b 20  ; tab-width: 8; 
0030: 63 6f 64 69 6e 67 3a 20 69 73 6f 2d 6c 61 74 69  coding: iso-lati
0040: 6e 2d 31 2d 75 6e 69 78 20 2d 2a 2d 0a 23 0a 23  n-1-unix -*-.#.#
0050: 09 24 49 64 3a 20 53 47 72 69 64 2e 74 63 6c 2c  .$Id: SGrid.tcl,
0060: 76 20 31 2e 36 20 32 30 30 32 2f 30 31 2f 32 34  v 1.6 2002/01/24
0070: 20 30 39 3a 31 33 3a 35 38 20 69 64 69 73 63 6f   09:13:58 idisco
0080: 76 65 72 79 20 45 78 70 20 24 0a 23 0a 23 20 53  very Exp $.#.# S
0090: 47 72 69 64 2e 74 63 6c 20 2d 2d 0a 23 0a 23 09  Grid.tcl --.#.#.
00a0: 54 68 69 73 20 66 69 6c 65 20 69 6d 70 6c 65 6d  This file implem
00b0: 65 6e 74 73 20 53 63 72 6f 6c 6c 65 64 20 47 72  ents Scrolled Gr
00c0: 69 64 20 77 69 64 67 65 74 73 0a 23 0a 23 20 43  id widgets.#.# C
00d0: 6f 70 79 72 69 67 68 74 20 28 63 29 20 31 39 39  opyright (c) 199
00e0: 33 2d 31 39 39 39 20 49 6f 69 20 4b 69 6d 20 4c  3-1999 Ioi Kim L
00f0: 61 6d 2e 0a 23 20 43 6f 70 79 72 69 67 68 74 20  am..# Copyright 
0100: 28 63 29 20 32 30 30 30 2d 32 30 30 31 20 54 69  (c) 2000-2001 Ti
0110: 78 20 50 72 6f 6a 65 63 74 20 47 72 6f 75 70 2e  x Project Group.
0120: 0a 23 0a 23 20 53 65 65 20 74 68 65 20 66 69 6c  .#.# See the fil
0130: 65 20 22 6c 69 63 65 6e 73 65 2e 74 65 72 6d 73  e "license.terms
0140: 22 20 66 6f 72 20 69 6e 66 6f 72 6d 61 74 69 6f  " for informatio
0150: 6e 20 6f 6e 20 75 73 61 67 65 20 61 6e 64 20 72  n on usage and r
0160: 65 64 69 73 74 72 69 62 75 74 69 6f 6e 0a 23 20  edistribution.# 
0170: 6f 66 20 74 68 69 73 20 66 69 6c 65 2c 20 61 6e  of this file, an
0180: 64 20 66 6f 72 20 61 20 44 49 53 43 4c 41 49 4d  d for a DISCLAIM
0190: 45 52 20 4f 46 20 41 4c 4c 20 57 41 52 52 41 4e  ER OF ALL WARRAN
01a0: 54 49 45 53 2e 0a 23 0a 0a 67 6c 6f 62 61 6c 20  TIES..#..global 
01b0: 74 6b 50 72 69 76 0a 69 66 20 7b 21 5b 6c 6c 65  tkPriv.if {![lle
01c0: 6e 67 74 68 20 5b 69 6e 66 6f 20 67 6c 6f 62 61  ngth [info globa
01d0: 6c 73 20 74 6b 50 72 69 76 5d 5d 7d 20 7b 0a 20  ls tkPriv]]} {. 
01e0: 20 20 20 74 6b 3a 3a 75 6e 73 75 70 70 6f 72 74     tk::unsupport
01f0: 65 64 3a 3a 45 78 70 6f 73 65 50 72 69 76 61 74  ed::ExposePrivat
0200: 65 56 61 72 69 61 62 6c 65 20 74 6b 50 72 69 76  eVariable tkPriv
0210: 0a 7d 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .}.#------------
0220: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0230: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0240: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0250: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23  --------------.#
0260: 20 74 6b 50 72 69 76 20 65 6c 65 6d 65 6e 74 73   tkPriv elements
0270: 20 75 73 65 64 20 69 6e 20 74 68 69 73 20 66 69   used in this fi
0280: 6c 65 3a 0a 23 0a 23 20 78 20 2d 09 0a 23 20 79  le:.#.# x -..# y
0290: 20 2d 09 0a 23 20 58 20 2d 09 0a 23 20 59 20 2d   -..# X -..# Y -
02a0: 09 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ..#-------------
02b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
02c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
02d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
02e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 0a  -------------.#.
02f0: 0a 74 69 78 57 69 64 67 65 74 43 6c 61 73 73 20  .tixWidgetClass 
0300: 74 69 78 53 63 72 6f 6c 6c 65 64 47 72 69 64 20  tixScrolledGrid 
0310: 7b 0a 20 20 20 20 2d 63 6c 61 73 73 6e 61 6d 65  {.    -classname
0320: 20 54 69 78 53 63 72 6f 6c 6c 65 64 47 72 69 64   TixScrolledGrid
0330: 0a 20 20 20 20 2d 73 75 70 65 72 63 6c 61 73 73  .    -superclass
0340: 20 74 69 78 53 63 72 6f 6c 6c 65 64 57 69 64 67   tixScrolledWidg
0350: 65 74 0a 20 20 20 20 2d 6d 65 74 68 6f 64 20 7b  et.    -method {
0360: 0a 20 20 20 20 7d 0a 20 20 20 20 2d 66 6c 61 67  .    }.    -flag
0370: 20 7b 0a 20 20 20 20 7d 0a 20 20 20 20 2d 63 6f   {.    }.    -co
0380: 6e 66 69 67 73 70 65 63 20 7b 0a 20 20 20 20 7d  nfigspec {.    }
0390: 0a 20 20 20 20 2d 64 65 66 61 75 6c 74 20 7b 0a  .    -default {.
03a0: 09 7b 2e 73 63 72 6f 6c 6c 62 61 72 09 09 09 61  .{.scrollbar...a
03b0: 75 74 6f 7d 0a 09 7b 2a 67 72 69 64 2e 62 6f 72  uto}..{*grid.bor
03c0: 64 65 72 57 69 64 74 68 09 09 31 7d 0a 09 7b 2a  derWidth..1}..{*
03d0: 67 72 69 64 2e 42 61 63 6b 67 72 6f 75 6e 64 09  grid.Background.
03e0: 09 23 63 33 63 33 63 33 7d 0a 09 7b 2a 67 72 69  .#c3c3c3}..{*gri
03f0: 64 2e 68 69 67 68 6c 69 67 68 74 42 61 63 6b 67  d.highlightBackg
0400: 72 6f 75 6e 64 09 23 64 39 64 39 64 39 7d 0a 09  round.#d9d9d9}..
0410: 7b 2a 67 72 69 64 2e 72 65 6c 69 65 66 09 09 09  {*grid.relief...
0420: 73 75 6e 6b 65 6e 7d 0a 09 7b 2a 67 72 69 64 2e  sunken}..{*grid.
0430: 74 61 6b 65 46 6f 63 75 73 09 09 31 7d 0a 09 7b  takeFocus..1}..{
0440: 2a 53 63 72 6f 6c 6c 62 61 72 2e 74 61 6b 65 46  *Scrollbar.takeF
0450: 6f 63 75 73 09 09 30 7d 0a 20 20 20 20 7d 0a 7d  ocus..0}.    }.}
0460: 0a 0a 70 72 6f 63 20 74 69 78 53 63 72 6f 6c 6c  ..proc tixScroll
0470: 65 64 47 72 69 64 3a 43 6f 6e 73 74 72 75 63 74  edGrid:Construct
0480: 57 69 64 67 65 74 20 7b 77 7d 20 7b 0a 20 20 20  Widget {w} {.   
0490: 20 75 70 76 61 72 20 23 30 20 24 77 20 64 61 74   upvar #0 $w dat
04a0: 61 0a 0a 20 20 20 20 74 69 78 43 68 61 69 6e 4d  a..    tixChainM
04b0: 65 74 68 6f 64 20 24 77 20 43 6f 6e 73 74 72 75  ethod $w Constru
04c0: 63 74 57 69 64 67 65 74 0a 0a 20 20 20 20 73 65  ctWidget..    se
04d0: 74 20 64 61 74 61 28 77 3a 67 72 69 64 29 20 5b  t data(w:grid) [
04e0: 74 69 78 47 72 69 64 20 24 77 2e 67 72 69 64 5d  tixGrid $w.grid]
04f0: 0a 0a 20 20 20 20 73 65 74 20 64 61 74 61 28 77  ..    set data(w
0500: 3a 68 73 62 29 20 5c 0a 09 5b 73 63 72 6f 6c 6c  :hsb) \..[scroll
0510: 62 61 72 20 24 77 2e 68 73 62 20 2d 6f 72 69 65  bar $w.hsb -orie
0520: 6e 74 20 68 6f 72 69 7a 6f 6e 74 61 6c 20 2d 74  nt horizontal -t
0530: 61 6b 65 66 6f 63 75 73 20 30 5d 0a 20 20 20 20  akefocus 0].    
0540: 73 65 74 20 64 61 74 61 28 77 3a 76 73 62 29 20  set data(w:vsb) 
0550: 5c 0a 09 5b 73 63 72 6f 6c 6c 62 61 72 20 24 77  \..[scrollbar $w
0560: 2e 76 73 62 20 2d 6f 72 69 65 6e 74 20 76 65 72  .vsb -orient ver
0570: 74 69 63 61 6c 20 2d 74 61 6b 65 66 6f 63 75 73  tical -takefocus
0580: 20 30 5d 0a 0a 20 20 20 20 73 65 74 20 64 61 74   0]..    set dat
0590: 61 28 70 77 3a 63 6c 69 65 6e 74 29 20 24 64 61  a(pw:client) $da
05a0: 74 61 28 77 3a 67 72 69 64 29 0a 0a 20 20 20 20  ta(w:grid)..    
05b0: 70 61 63 6b 20 24 64 61 74 61 28 77 3a 67 72 69  pack $data(w:gri
05c0: 64 29 20 2d 65 78 70 61 6e 64 20 79 65 73 20 2d  d) -expand yes -
05d0: 66 69 6c 6c 20 62 6f 74 68 20 2d 70 61 64 78 20  fill both -padx 
05e0: 30 20 2d 70 61 64 79 20 30 0a 7d 0a 0a 70 72 6f  0 -pady 0.}..pro
05f0: 63 20 74 69 78 53 63 72 6f 6c 6c 65 64 47 72 69  c tixScrolledGri
0600: 64 3a 53 65 74 42 69 6e 64 69 6e 67 73 20 7b 77  d:SetBindings {w
0610: 7d 20 7b 0a 20 20 20 20 75 70 76 61 72 20 23 30  } {.    upvar #0
0620: 20 24 77 20 64 61 74 61 0a 0a 20 20 20 20 74 69   $w data..    ti
0630: 78 43 68 61 69 6e 4d 65 74 68 6f 64 20 24 77 20  xChainMethod $w 
0640: 53 65 74 42 69 6e 64 69 6e 67 73 0a 0a 20 20 20  SetBindings..   
0650: 20 24 64 61 74 61 28 77 3a 67 72 69 64 29 20 63   $data(w:grid) c
0660: 6f 6e 66 69 67 20 5c 0a 09 2d 78 73 63 72 6f 6c  onfig \..-xscrol
0670: 6c 63 6f 6d 6d 61 6e 64 20 22 24 64 61 74 61 28  lcommand "$data(
0680: 77 3a 68 73 62 29 20 73 65 74 22 5c 0a 09 2d 79  w:hsb) set"\..-y
0690: 73 63 72 6f 6c 6c 63 6f 6d 6d 61 6e 64 20 22 24  scrollcommand "$
06a0: 64 61 74 61 28 77 3a 76 73 62 29 20 73 65 74 22  data(w:vsb) set"
06b0: 5c 0a 09 2d 73 69 7a 65 63 6d 64 20 5b 6c 69 73  \..-sizecmd [lis
06c0: 74 20 74 69 78 53 63 72 6f 6c 6c 65 64 57 69 64  t tixScrolledWid
06d0: 67 65 74 3a 43 6f 6e 66 69 67 75 72 65 20 24 77  get:Configure $w
06e0: 5d 20 5c 0a 09 2d 66 6f 72 6d 61 74 63 6d 64 20  ] \..-formatcmd 
06f0: 22 74 69 78 43 61 6c 6c 4d 65 74 68 6f 64 20 24  "tixCallMethod $
0700: 77 20 46 6f 72 6d 61 74 43 6d 64 22 0a 0a 20 20  w FormatCmd"..  
0710: 20 20 24 64 61 74 61 28 77 3a 68 73 62 29 20 63    $data(w:hsb) c
0720: 6f 6e 66 69 67 20 2d 63 6f 6d 6d 61 6e 64 20 22  onfig -command "
0730: 24 64 61 74 61 28 77 3a 67 72 69 64 29 20 78 76  $data(w:grid) xv
0740: 69 65 77 22 0a 20 20 20 20 24 64 61 74 61 28 77  iew".    $data(w
0750: 3a 76 73 62 29 20 63 6f 6e 66 69 67 20 2d 63 6f  :vsb) config -co
0760: 6d 6d 61 6e 64 20 22 24 64 61 74 61 28 77 3a 67  mmand "$data(w:g
0770: 72 69 64 29 20 79 76 69 65 77 22 0a 0a 20 20 20  rid) yview"..   
0780: 20 62 69 6e 64 74 61 67 73 20 24 64 61 74 61 28   bindtags $data(
0790: 77 3a 67 72 69 64 29 20 5c 0a 09 22 24 64 61 74  w:grid) \.."$dat
07a0: 61 28 77 3a 67 72 69 64 29 20 54 69 78 53 47 72  a(w:grid) TixSGr
07b0: 69 64 20 54 69 78 47 72 69 64 20 5b 77 69 6e 66  id TixGrid [winf
07c0: 6f 20 74 6f 70 6c 65 76 65 6c 20 24 64 61 74 61  o toplevel $data
07d0: 28 77 3a 67 72 69 64 29 5d 20 61 6c 6c 22 20 20  (w:grid)] all"  
07e0: 20 20 0a 0a 20 20 20 20 74 69 78 53 65 74 4d 65    ..    tixSetMe
07f0: 67 61 57 69 64 67 65 74 20 24 64 61 74 61 28 77  gaWidget $data(w
0800: 3a 67 72 69 64 29 20 24 77 0a 7d 0a 0a 23 2d 2d  :grid) $w.}..#--
0810: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0820: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0830: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0840: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0850: 2d 2d 2d 2d 0a 23 09 09 09 52 41 57 20 65 76 65  ----.#...RAW eve
0860: 6e 74 20 62 69 6e 64 69 6e 67 73 0a 23 2d 2d 2d  nt bindings.#---
0870: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0880: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0890: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
08a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
08b0: 2d 2d 2d 0a 70 72 6f 63 20 74 69 78 53 63 72 6f  ---.proc tixScro
08c0: 6c 6c 65 64 47 72 69 64 42 69 6e 64 20 7b 7d 20  lledGridBind {} 
08d0: 7b 0a 20 20 20 20 74 69 78 42 69 6e 64 20 54 69  {.    tixBind Ti
08e0: 78 53 63 72 6f 6c 6c 65 64 47 72 69 64 20 3c 42  xScrolledGrid <B
08f0: 75 74 74 6f 6e 50 72 65 73 73 2d 31 3e 20 7b 0a  uttonPress-1> {.
0900: 09 74 69 78 53 63 72 6f 6c 6c 65 64 47 72 69 64  .tixScrolledGrid
0910: 3a 42 75 74 74 6f 6e 2d 31 20 5b 74 69 78 47 65  :Button-1 [tixGe
0920: 74 4d 65 67 61 57 69 64 67 65 74 20 25 57 5d 20  tMegaWidget %W] 
0930: 25 78 20 25 79 0a 20 20 20 20 7d 0a 20 20 20 20  %x %y.    }.    
0940: 74 69 78 42 69 6e 64 20 54 69 78 53 63 72 6f 6c  tixBind TixScrol
0950: 6c 65 64 47 72 69 64 20 3c 53 68 69 66 74 2d 42  ledGrid <Shift-B
0960: 75 74 74 6f 6e 50 72 65 73 73 2d 31 3e 20 7b 0a  uttonPress-1> {.
0970: 09 74 69 78 53 63 72 6f 6c 6c 65 64 47 72 69 64  .tixScrolledGrid
0980: 3a 53 68 69 66 74 2d 42 75 74 74 6f 6e 2d 31 20  :Shift-Button-1 
0990: 25 57 20 25 78 20 25 79 0a 20 20 20 20 7d 0a 20  %W %x %y.    }. 
09a0: 20 20 20 74 69 78 42 69 6e 64 20 54 69 78 53 63     tixBind TixSc
09b0: 72 6f 6c 6c 65 64 47 72 69 64 20 3c 43 6f 6e 74  rolledGrid <Cont
09c0: 72 6f 6c 2d 42 75 74 74 6f 6e 50 72 65 73 73 2d  rol-ButtonPress-
09d0: 31 3e 20 7b 0a 09 74 69 78 53 63 72 6f 6c 6c 65  1> {..tixScrolle
09e0: 64 47 72 69 64 3a 43 6f 6e 74 72 6f 6c 2d 42 75  dGrid:Control-Bu
09f0: 74 74 6f 6e 2d 31 20 25 57 20 25 78 20 25 79 0a  tton-1 %W %x %y.
0a00: 20 20 20 20 7d 0a 20 20 20 20 74 69 78 42 69 6e      }.    tixBin
0a10: 64 20 54 69 78 53 63 72 6f 6c 6c 65 64 47 72 69  d TixScrolledGri
0a20: 64 20 3c 42 75 74 74 6f 6e 52 65 6c 65 61 73 65  d <ButtonRelease
0a30: 2d 31 3e 20 7b 0a 09 74 69 78 53 63 72 6f 6c 6c  -1> {..tixScroll
0a40: 65 64 47 72 69 64 3a 42 75 74 74 6f 6e 52 65 6c  edGrid:ButtonRel
0a50: 65 61 73 65 2d 31 20 25 57 20 25 78 20 25 79 0a  ease-1 %W %x %y.
0a60: 20 20 20 20 7d 0a 20 20 20 20 74 69 78 42 69 6e      }.    tixBin
0a70: 64 20 54 69 78 53 63 72 6f 6c 6c 65 64 47 72 69  d TixScrolledGri
0a80: 64 20 3c 44 6f 75 62 6c 65 2d 42 75 74 74 6f 6e  d <Double-Button
0a90: 50 72 65 73 73 2d 31 3e 20 7b 0a 09 74 69 78 53  Press-1> {..tixS
0aa0: 63 72 6f 6c 6c 65 64 47 72 69 64 3a 44 6f 75 62  crolledGrid:Doub
0ab0: 6c 65 2d 31 20 25 57 20 20 25 78 20 25 79 0a 20  le-1 %W  %x %y. 
0ac0: 20 20 20 7d 0a 20 20 20 20 74 69 78 42 69 6e 64     }.    tixBind
0ad0: 20 54 69 78 53 63 72 6f 6c 6c 65 64 47 72 69 64   TixScrolledGrid
0ae0: 20 3c 42 31 2d 4d 6f 74 69 6f 6e 3e 20 7b 0a 09   <B1-Motion> {..
0af0: 73 65 74 20 74 6b 50 72 69 76 28 78 29 20 25 78  set tkPriv(x) %x
0b00: 20 0a 09 73 65 74 20 74 6b 50 72 69 76 28 79 29   ..set tkPriv(y)
0b10: 20 25 79 0a 09 73 65 74 20 74 6b 50 72 69 76 28   %y..set tkPriv(
0b20: 58 29 20 25 58 0a 09 73 65 74 20 74 6b 50 72 69  X) %X..set tkPri
0b30: 76 28 59 29 20 25 59 0a 0a 09 74 69 78 53 63 72  v(Y) %Y...tixScr
0b40: 6f 6c 6c 65 64 47 72 69 64 3a 42 31 2d 4d 6f 74  olledGrid:B1-Mot
0b50: 69 6f 6e 20 25 57 20 25 78 20 25 79 0a 20 20 20  ion %W %x %y.   
0b60: 20 7d 0a 20 20 20 20 74 69 78 42 69 6e 64 20 54   }.    tixBind T
0b70: 69 78 53 63 72 6f 6c 6c 65 64 47 72 69 64 20 3c  ixScrolledGrid <
0b80: 43 6f 6e 74 72 6f 6c 2d 42 31 2d 4d 6f 74 69 6f  Control-B1-Motio
0b90: 6e 3e 20 7b 0a 09 73 65 74 20 74 6b 50 72 69 76  n> {..set tkPriv
0ba0: 28 78 29 20 25 78 20 0a 09 73 65 74 20 74 6b 50  (x) %x ..set tkP
0bb0: 72 69 76 28 79 29 20 25 79 0a 09 73 65 74 20 74  riv(y) %y..set t
0bc0: 6b 50 72 69 76 28 58 29 20 25 58 0a 09 73 65 74  kPriv(X) %X..set
0bd0: 20 74 6b 50 72 69 76 28 59 29 20 25 59 0a 0a 09   tkPriv(Y) %Y...
0be0: 74 69 78 53 63 72 6f 6c 6c 65 64 47 72 69 64 3a  tixScrolledGrid:
0bf0: 43 6f 6e 74 72 6f 6c 2d 42 31 2d 4d 6f 74 69 6f  Control-B1-Motio
0c00: 6e 20 25 57 20 25 78 20 25 79 0a 20 20 20 20 7d  n %W %x %y.    }
0c10: 0a 20 20 20 20 74 69 78 42 69 6e 64 20 54 69 78  .    tixBind Tix
0c20: 53 63 72 6f 6c 6c 65 64 47 72 69 64 20 3c 42 31  ScrolledGrid <B1
0c30: 2d 4c 65 61 76 65 3e 20 7b 0a 09 73 65 74 20 74  -Leave> {..set t
0c40: 6b 50 72 69 76 28 78 29 20 25 78 20 0a 09 73 65  kPriv(x) %x ..se
0c50: 74 20 74 6b 50 72 69 76 28 79 29 20 25 79 0a 09  t tkPriv(y) %y..
0c60: 73 65 74 20 74 6b 50 72 69 76 28 58 29 20 25 58  set tkPriv(X) %X
0c70: 0a 09 73 65 74 20 74 6b 50 72 69 76 28 59 29 20  ..set tkPriv(Y) 
0c80: 25 59 0a 0a 09 74 69 78 53 63 72 6f 6c 6c 65 64  %Y...tixScrolled
0c90: 47 72 69 64 3a 42 31 2d 4c 65 61 76 65 20 25 57  Grid:B1-Leave %W
0ca0: 0a 20 20 20 20 7d 0a 20 20 20 20 74 69 78 42 69  .    }.    tixBi
0cb0: 6e 64 20 54 69 78 53 63 72 6f 6c 6c 65 64 47 72  nd TixScrolledGr
0cc0: 69 64 20 3c 42 31 2d 45 6e 74 65 72 3e 20 7b 0a  id <B1-Enter> {.
0cd0: 09 74 69 78 53 63 72 6f 6c 6c 65 64 47 72 69 64  .tixScrolledGrid
0ce0: 3a 42 31 2d 45 6e 74 65 72 20 25 57 20 25 78 20  :B1-Enter %W %x 
0cf0: 25 79 0a 20 20 20 20 7d 0a 20 20 20 20 74 69 78  %y.    }.    tix
0d00: 42 69 6e 64 20 54 69 78 53 63 72 6f 6c 6c 65 64  Bind TixScrolled
0d10: 47 72 69 64 20 3c 43 6f 6e 74 72 6f 6c 2d 42 31  Grid <Control-B1
0d20: 2d 4c 65 61 76 65 3e 20 7b 0a 09 73 65 74 20 74  -Leave> {..set t
0d30: 6b 50 72 69 76 28 78 29 20 25 78 20 0a 09 73 65  kPriv(x) %x ..se
0d40: 74 20 74 6b 50 72 69 76 28 79 29 20 25 79 0a 09  t tkPriv(y) %y..
0d50: 73 65 74 20 74 6b 50 72 69 76 28 58 29 20 25 58  set tkPriv(X) %X
0d60: 0a 09 73 65 74 20 74 6b 50 72 69 76 28 59 29 20  ..set tkPriv(Y) 
0d70: 25 59 0a 0a 09 74 69 78 53 63 72 6f 6c 6c 65 64  %Y...tixScrolled
0d80: 47 72 69 64 3a 43 6f 6e 74 72 6f 6c 2d 42 31 2d  Grid:Control-B1-
0d90: 4c 65 61 76 65 20 25 57 0a 20 20 20 20 7d 0a 20  Leave %W.    }. 
0da0: 20 20 20 74 69 78 42 69 6e 64 20 54 69 78 53 63     tixBind TixSc
0db0: 72 6f 6c 6c 65 64 47 72 69 64 20 3c 43 6f 6e 74  rolledGrid <Cont
0dc0: 72 6f 6c 2d 42 31 2d 45 6e 74 65 72 3e 20 7b 0a  rol-B1-Enter> {.
0dd0: 09 74 69 78 53 63 72 6f 6c 6c 65 64 47 72 69 64  .tixScrolledGrid
0de0: 3a 43 6f 6e 74 72 6f 6c 2d 42 31 2d 45 6e 74 65  :Control-B1-Ente
0df0: 72 20 25 57 20 25 78 20 25 79 0a 20 20 20 20 7d  r %W %x %y.    }
0e00: 0a 0a 20 20 20 20 23 20 4b 65 79 62 6f 61 72 64  ..    # Keyboard
0e10: 20 62 69 6e 64 69 6e 67 73 0a 20 20 20 20 23 0a   bindings.    #.
0e20: 20 20 20 20 74 69 78 42 69 6e 64 20 54 69 78 53      tixBind TixS
0e30: 63 72 6f 6c 6c 65 64 47 72 69 64 20 3c 55 70 3e  crolledGrid <Up>
0e40: 20 7b 0a 09 74 69 78 53 63 72 6f 6c 6c 65 64 47   {..tixScrolledG
0e50: 72 69 64 3a 44 69 72 4b 65 79 20 25 57 20 75 70  rid:DirKey %W up
0e60: 0a 20 20 20 20 7d 0a 20 20 20 20 74 69 78 42 69  .    }.    tixBi
0e70: 6e 64 20 54 69 78 53 63 72 6f 6c 6c 65 64 47 72  nd TixScrolledGr
0e80: 69 64 20 3c 44 6f 77 6e 3e 20 7b 0a 09 74 69 78  id <Down> {..tix
0e90: 53 63 72 6f 6c 6c 65 64 47 72 69 64 3a 44 69 72  ScrolledGrid:Dir
0ea0: 4b 65 79 20 25 57 20 64 6f 77 6e 0a 20 20 20 20  Key %W down.    
0eb0: 7d 0a 20 20 20 20 74 69 78 42 69 6e 64 20 54 69  }.    tixBind Ti
0ec0: 78 53 63 72 6f 6c 6c 65 64 47 72 69 64 20 3c 4c  xScrolledGrid <L
0ed0: 65 66 74 3e 20 7b 0a 09 74 69 78 53 63 72 6f 6c  eft> {..tixScrol
0ee0: 6c 65 64 47 72 69 64 3a 44 69 72 4b 65 79 20 25  ledGrid:DirKey %
0ef0: 57 20 6c 65 66 74 0a 20 20 20 20 7d 0a 20 20 20  W left.    }.   
0f00: 20 74 69 78 42 69 6e 64 20 54 69 78 53 63 72 6f   tixBind TixScro
0f10: 6c 6c 65 64 47 72 69 64 20 3c 52 69 67 68 74 3e  lledGrid <Right>
0f20: 20 7b 0a 09 74 69 78 53 63 72 6f 6c 6c 65 64 47   {..tixScrolledG
0f30: 72 69 64 3a 44 69 72 4b 65 79 20 25 57 20 72 69  rid:DirKey %W ri
0f40: 67 68 74 0a 20 20 20 20 7d 0a 20 20 20 20 74 69  ght.    }.    ti
0f50: 78 42 69 6e 64 20 54 69 78 53 63 72 6f 6c 6c 65  xBind TixScrolle
0f60: 64 47 72 69 64 20 3c 50 72 69 6f 72 3e 20 7b 0a  dGrid <Prior> {.
0f70: 09 25 57 20 79 76 69 65 77 20 73 63 72 6f 6c 6c  .%W yview scroll
0f80: 20 2d 31 20 70 61 67 65 73 0a 20 20 20 20 7d 0a   -1 pages.    }.
0f90: 20 20 20 20 74 69 78 42 69 6e 64 20 54 69 78 53      tixBind TixS
0fa0: 63 72 6f 6c 6c 65 64 47 72 69 64 20 3c 4e 65 78  crolledGrid <Nex
0fb0: 74 3e 20 7b 0a 09 25 57 20 79 76 69 65 77 20 73  t> {..%W yview s
0fc0: 63 72 6f 6c 6c 20 31 20 70 61 67 65 73 0a 20 20  croll 1 pages.  
0fd0: 20 20 7d 0a 20 20 20 20 74 69 78 42 69 6e 64 20    }.    tixBind 
0fe0: 54 69 78 53 63 72 6f 6c 6c 65 64 47 72 69 64 20  TixScrolledGrid 
0ff0: 3c 52 65 74 75 72 6e 3e 20 7b 0a 09 74 69 78 53  <Return> {..tixS
1000: 63 72 6f 6c 6c 65 64 47 72 69 64 3a 52 65 74 75  crolledGrid:Retu
1010: 72 6e 20 25 57 20 0a 20 20 20 20 7d 0a 20 20 20  rn %W .    }.   
1020: 20 74 69 78 42 69 6e 64 20 54 69 78 53 63 72 6f   tixBind TixScro
1030: 6c 6c 65 64 47 72 69 64 20 3c 73 70 61 63 65 3e  lledGrid <space>
1040: 20 7b 0a 09 74 69 78 53 63 72 6f 6c 6c 65 64 47   {..tixScrolledG
1050: 72 69 64 3a 53 70 61 63 65 20 25 57 20 0a 20 20  rid:Space %W .  
1060: 20 20 7d 0a 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d    }.}..#--------
1070: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1080: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1090: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
10a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23  --------------.#
10b0: 0a 23 0a 23 09 09 09 20 4d 6f 75 73 65 20 62 69  .#.#... Mouse bi
10c0: 6e 64 69 6e 67 73 0a 23 0a 23 0a 23 2d 2d 2d 2d  ndings.#.#.#----
10d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
10e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
10f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1100: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1110: 2d 2d 0a 70 72 6f 63 20 74 69 78 53 63 72 6f 6c  --.proc tixScrol
1120: 6c 65 64 47 72 69 64 3a 42 75 74 74 6f 6e 2d 31  ledGrid:Button-1
1130: 20 7b 77 20 78 20 79 7d 20 7b 0a 20 20 20 20 69   {w x y} {.    i
1140: 66 20 7b 5b 24 77 20 63 67 65 74 20 2d 73 74 61  f {[$w cget -sta
1150: 74 65 5d 20 3d 3d 20 22 64 69 73 61 62 6c 65 64  te] == "disabled
1160: 22 7d 20 7b 0a 09 72 65 74 75 72 6e 0a 20 20 20  "} {..return.   
1170: 20 7d 0a 20 20 20 20 69 66 20 7b 5b 24 77 20 63   }.    if {[$w c
1180: 67 65 74 20 2d 74 61 6b 65 66 6f 63 75 73 5d 7d  get -takefocus]}
1190: 20 7b 0a 09 66 6f 63 75 73 20 24 77 0a 20 20 20   {..focus $w.   
11a0: 20 7d 0a 20 20 20 20 63 61 73 65 20 5b 74 69 78   }.    case [tix
11b0: 53 63 72 6f 6c 6c 65 64 3a 47 65 74 53 74 61 74  Scrolled:GetStat
11c0: 65 20 24 77 5d 20 7b 0a 09 7b 30 7d 20 7b 0a 09  e $w] {..{0} {..
11d0: 20 20 20 20 74 69 78 53 63 72 6f 6c 6c 65 64 47      tixScrolledG
11e0: 72 69 64 3a 47 6f 53 74 61 74 65 20 73 31 20 24  rid:GoState s1 $
11f0: 77 20 24 78 20 24 79 0a 20 20 20 20 20 20 20 09  w $x $y.       .
1200: 7d 0a 09 7b 62 30 7d 20 7b 0a 09 20 20 20 20 74  }..{b0} {..    t
1210: 69 78 53 63 72 6f 6c 6c 65 64 47 72 69 64 3a 47  ixScrolledGrid:G
1220: 6f 53 74 61 74 65 20 62 31 20 24 77 20 24 78 20  oState b1 $w $x 
1230: 24 79 0a 20 20 20 20 20 20 20 09 7d 0a 09 7b 6d  $y.       .}..{m
1240: 30 7d 20 7b 0a 09 20 20 20 20 74 69 78 53 63 72  0} {..    tixScr
1250: 6f 6c 6c 65 64 47 72 69 64 3a 47 6f 53 74 61 74  olledGrid:GoStat
1260: 65 20 6d 31 20 24 77 20 24 78 20 24 79 0a 20 20  e m1 $w $x $y.  
1270: 20 20 20 20 20 09 7d 0a 09 7b 65 30 7d 20 7b 0a       .}..{e0} {.
1280: 09 20 20 20 20 74 69 78 53 63 72 6f 6c 6c 65 64  .    tixScrolled
1290: 47 72 69 64 3a 47 6f 53 74 61 74 65 20 65 31 20  Grid:GoState e1 
12a0: 24 77 20 24 78 20 24 79 0a 20 20 20 20 20 20 20  $w $x $y.       
12b0: 09 7d 0a 20 20 20 20 7d 0a 7d 0a 0a 0a 0a 23 2d  .}.    }.}....#-
12c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
12d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
12e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
12f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1300: 2d 2d 2d 2d 2d 0a 23 0a 23 09 09 6f 70 74 69 6f  -----.#.#..optio
1310: 6e 20 63 6f 6e 66 69 67 73 0a 23 2d 2d 2d 2d 2d  n configs.#-----
1320: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1330: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1340: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1350: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1360: 2d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  -..#------------
1370: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1380: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1390: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 0a 23 09 09  ----------.#.#..
13b0: 57 69 64 67 65 74 20 63 6f 6d 6d 61 6e 64 73 0a  Widget commands.
13c0: 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  #---------------
13d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1400: 2d 2d 2d 2d 2d 2d 2d 0a 0a 0a 23 2d 2d 2d 2d 2d  -------...#-----
1410: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1420: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1430: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1440: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1450: 2d 0a 23 0a 23 09 09 50 72 69 76 61 74 65 20 4d  -.#.#..Private M
1460: 65 74 68 6f 64 73 0a 23 2d 2d 2d 2d 2d 2d 2d 2d  ethods.#--------
1470: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1480: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1490: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a  --------------..
14b0: 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  #---------------
14c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14f0: 2d 2d 2d 2d 2d 2d 2d 0a 23 09 09 56 69 72 74 75  -------.#..Virtu
1500: 61 6c 20 4d 65 74 68 6f 64 73 0a 23 2d 2d 2d 2d  al Methods.#----
1510: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1520: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1530: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1540: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1550: 2d 2d 0a 70 72 6f 63 20 74 69 78 53 63 72 6f 6c  --.proc tixScrol
1560: 6c 65 64 47 72 69 64 3a 46 6f 72 6d 61 74 43 6d  ledGrid:FormatCm
1570: 64 20 7b 77 20 61 72 65 61 20 78 31 20 79 31 20  d {w area x1 y1 
1580: 78 32 20 79 32 7d 20 7b 0a 20 20 20 20 23 20 64  x2 y2} {.    # d
1590: 6f 20 6e 6f 74 68 69 6e 67 0a 7d 0a 0a 23 2d 2d  o nothing.}..#--
15a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15e0: 2d 2d 2d 2d 0a 23 20 76 69 72 74 75 61 6c 20 66  ----.# virtual f
15f0: 75 6e 63 74 69 6f 6e 73 20 74 6f 20 71 75 65 72  unctions to quer
1600: 79 20 74 68 65 20 63 6c 69 65 6e 74 20 77 69 6e  y the client win
1610: 64 6f 77 27 73 20 73 63 72 6f 6c 6c 20 72 65 71  dow's scroll req
1620: 75 69 72 65 6d 65 6e 74 0a 23 2d 2d 2d 2d 2d 2d  uirement.#------
1630: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1640: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1650: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1660: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1670: 0a 70 72 6f 63 20 74 69 78 53 63 72 6f 6c 6c 65  .proc tixScrolle
1680: 64 47 72 69 64 3a 47 65 6f 6d 65 74 72 79 49 6e  dGrid:GeometryIn
1690: 66 6f 20 7b 77 20 6d 57 20 6d 48 7d 20 7b 0a 20  fo {w mW mH} {. 
16a0: 20 20 20 75 70 76 61 72 20 23 30 20 24 77 20 64     upvar #0 $w d
16b0: 61 74 61 0a 0a 0a 20 20 20 20 69 66 20 7b 24 6d  ata...    if {$m
16c0: 57 20 3c 20 31 7d 20 7b 0a 09 73 65 74 20 6d 57  W < 1} {..set mW
16d0: 20 31 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20   1.    }.    if 
16e0: 7b 24 6d 48 20 3c 20 31 7d 20 7b 0a 09 73 65 74  {$mH < 1} {..set
16f0: 20 6d 48 20 31 0a 20 20 20 20 7d 0a 0a 20 20 20   mH 1.    }..   
1700: 20 72 65 74 75 72 6e 20 5b 24 64 61 74 61 28 77   return [$data(w
1710: 3a 67 72 69 64 29 20 67 65 6f 6d 65 74 72 79 69  :grid) geometryi
1720: 6e 66 6f 20 24 6d 57 20 24 6d 48 5d 0a 7d 0a     nfo $mW $mH].}.