Re: Re: StringGrid Cells cleanup

Posted by jejyjose on November 03, 2000 at 15:27:00:

In Reply to: Re: StringGrid Cells cleanup posted by Martin Jackson on November 02, 2000 at 11:10:13:

How to I right-align the items of a column in a string grid


: 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);
: var
: l_loop : integer;
: begin
: LockWindowUpdate( aStringGrid.Handle );
: try
: for l_loop := 1 to aStringGrid.RowCount - 1 do
: aStringGrid.Rows[ l_loop ].Clear;
: finally
: LockWindowUpdate( 0 );
: end;
: end;

: 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: