Re: StringGrid Cells cleanup

Posted by Martin Jackson on November 02, 2000 at 11:10:13:

In Reply to: StringGrid Cells cleanup posted by Denis on November 02, 2000 at 04:56:09:

There is no clear method for a stringgrid. However, there is a rows property which returns a stringlist containing all of the values across the given row. The following procedure will clear a string grid:

procedure ClearGrid(aStringGrid: TStringGrid);
  l_loop : integer;
  LockWindowUpdate( aStringGrid.Handle );
    for l_loop := 1 to aStringGrid.RowCount - 1 do
      aStringGrid.Rows[ l_loop ].Clear;
    LockWindowUpdate( 0 );

The lockwindowupdate will prevent Windows from repainting the grid until it finishes the operation. The lockwindowupdate(0) will allow repainting again. This prevents flicker whilst clearing the grid.

: is there any comand like Memo.lines.clean but for stringrid. Also i need this command to clean all lines in stringgrit, but leave cells[0,0],[1.0][2.0].

Related Articles and Replies: