title: Stringgrid with buttons
body: <p>1st Question:</p>
  
  <p>How do you call the part in stringgrid that is not visible? You need to scroll to see it.<br>
  For example:<br>
  There are 20 rows in a stringgrid but you can see only 10 at a time. You need to scroll to see other 10. How are the "hidden" ones called?  </p>
  
  <p>2nd Question:</p>
  
  <p>I know this is probably not the right way to do it so some pointers would be appreciated.<br>
  I have a string grid with 1 fixed row. I add ColorButtons at runtime. So I populate 1 column with buttons.
  I use this buttons to "insert/delete" rows. As long as all of the grid is in the "visible" part this works well.
  Problem occcurs when I "insert" new rows and move the buttons to the "hidden" part. The last button is then drawn to Cell[0,0]. Other buttons in the "hidden" part are drawn correctly. Any idea why this happens? Should I find a way to manage this problem in the OnDraw method or is there a better (correct) way to do this?  </p>
  
  <p>Code:</p>
  
  <pre><code>procedure Tform1.addButton(Grid : TStringGrid; ACol : Integer; ARow : Integer);
  var
    bt : TColorButton;
    Rect : TRect;
    index : Integer;
  begin
      Rect := Grid.CellRect(ACol,ARow);
      bt := TColorButton.Create(Grid);
      bt.Parent := Grid;
      bt.BackColor := clCream;
      bt.Font.Size := 14;
      bt.Width := 50;
      bt.Top := Rect.Top;
      bt.Left := Rect.Left;
      bt.Caption := '+';
      bt.Name := 'bt'+IntToStr(ARow);
      index := Grid.ComponentCount-1;
      bt :=(Grid.Components[index] as TColorButton);
      Grid.Objects[ACol,ARow] := Grid.Components[index];
      bt.OnMouseUp := Grid.OnMouseUp;
      bt.OnMouseMove := Grid.OnMouseMove;
      bt.Visible := true;
  end;
  
  procedure MoveRowPlus(Grid : TStringGrid; Arow : Integer; stRow : Integer);
  var
    r, index : Integer;
    bt : TColorButton;
    Rect : TRect;
  begin
    Grid.RowCount := Grid.RowCount+stRow;
  
    for r := Grid.RowCount - 1 downto ARow+stRow do
      begin
        Grid.Rows[r] := Grid.Rows[r-StRow];
      end;
  
    index := Grid.ComponentCount-1;
    for r := Grid.RowCount - 1 downto ARow+stRow do
      begin
        bt :=(Grid.Components[index] as TColorButton);
        Rect := Grid.CellRect(10,r);
        bt.Top := Rect.Top;
        bt.Left := Rect.Left;
        Grid.Objects[10,r] := Grid.Components[index];
        dec(index);
      end;
        for r := ARow to (ARow +stRow-1) do
          begin
            Grid.Rows[r].Clear;
          end;  
  end;
  
  procedure MoveRowMinus(Grid : TStringGrid; Arow : Integer; stRow : Integer);
  var
    r, index : Integer;
    bt : TColorButton;
    Rect : TRect;
  begin
  
    for r := ARow to Grid.RowCount-stRow-1 do
      begin
        Grid.Rows[r] := Grid.Rows[r+StRow];
      end;
  
    index := ARow-1;
    for r := ARow to Grid.RowCount-stRow-1 do
      begin
        Rect := Grid.CellRect(10,r);
        bt :=(Grid.Components[index] as TColorButton);
        bt.Top := Rect.Top;
        bt.Left := Rect.Left;
        Grid.Objects[10,r] := Grid.Components[index];
        bt.Visible := true;
        inc(index);
      end;
  
    for r := Grid.RowCount-stRow to Grid.RowCount-1 do
      begin
        Grid.Rows[r].Clear;
      end;
    Grid.RowCount := Grid.RowCount-stRow;
  end;
  </code></pre>