#
# Module for browsing around in Scrollbar widgets
#


# Where is index of left/top edge of scroller. (It is kept the same size, and
# if it is attached to a widget, it resets the widget, too).
proc th_Scrollbar_goto {w where} {
  set s [lindex [$w get] 0]
  if {[catch {tkScrollToPos $w $where}]} {bell ; return 0}
  if {[lindex [$w get] 0] != $s} {bell ; return 0}
  return 1
}


# Exchanges scrollbar mark with its current position.
proc th_Scrollbar_exchange_mark {w} {
  global TH ; if {[catch "set TH(Mark,$w)"]} {bell ; return}
  set s [lindex [$w get] 0]
  th_Scrollbar_goto $w $TH(Mark,$w)
  set TH(Mark,$w) $s
}
