Listing 4

// Add to TScrollWin class
long Width, Height;
virtual void SetupWindow();
void AdjustScroller();

// Add to SCROLL.CPP
void TScrollWin::SetupWindow()
{
  int x1, y1, x2, y2;

  TWindow::SetupWindow();
  GetCoords(NUMROWS, NUMCOLS, x1, y1, x2, y2);
  Width = x2;
  Height = y2;
  AdjustScroller();
}

// Add to SCROLL.CPP
void TScrollWin::AdjustScroller()
{
  RECT R;
  long H, W;

  GetClientRect(HWindow, &R);
  W = Width - (R.right - R.left);
  H = Height - (R.bottom - R.top);
  Scroller->SetRange(W / Scroller->XUnit, H / Scroller->YUnit);
}
