Solved

TStringGrid.Clear (deletes all cells in a stringgrid)

Posted on 2003-10-26
10
5,350 Views
Last Modified: 2007-12-19
I need a method ("Clear") that clears all cells of a string grid and then deletes them.

So stringgrid.Clear finally DELETES ALL CELLS (ROWS/COLS..whatever you like) of the stringgrid.

Thx.
0
Comment
Question by:Catalin80
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9623277
just set the rowcount- and colcount-properties to 0 (zero)

meikl ;-)
0
 

Author Comment

by:Catalin80
ID: 9625942
Already tryed that. Doesn't work. (delphi6)
0
 

Author Comment

by:Catalin80
ID: 9625954
There is still 1 cell left.
0
 
LVL 3

Expert Comment

by:huferry
ID: 9625962
Do you meant the content only?

procedure ClearStringGrid(Grid: TStringGrid);
var
  I: Integer;
  J: Integer;
begin
  for I := 0 to Grid.ColCount-1 do
    for J := 0 to Grid.RowCount-1 do
      Grid.Cells[I,J] := '';
end;
0
 

Author Comment

by:Catalin80
ID: 9626412
The content AND the CELLS. I need one tstringgrid WITH NO CELLS. If that isn't possible then I just can hide the entire table.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 27

Expert Comment

by:kretzschmar
ID: 9626550
there allways one cell!
you can't get rid of it
0
 

Author Comment

by:Catalin80
ID: 9626901
Ok. but what was that about "colcont=0;rowcount=0" ?
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9626919
>but what was that about "colcont=0;rowcount=0" ?
that deletes the whole content from the grid,
that one cell left is a default painting bahaviour, if the grid is empty
-> maybe this could be adjusted by using ownerdraw

meikl ;-)
0
 
LVL 3

Accepted Solution

by:
huferry earned 50 total points
ID: 9632430
if the grid is empty, just make it invisible. Then you'll have no cell at all.

0
 
LVL 2

Expert Comment

by:gangsterboss
ID: 9647093
try setting the stringgrids visible property to false when u want to get rid of them all
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video discusses moving either the default database or any database to a new volume.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now