Board index » delphi » String Grid Question...

String Grid Question...

I have a basic TStringGrid.  I use it to store properties of media objects.
If there is no properties, how do I make it so there is no rows in the grid.
IT always defaults to 1 row no matter what.  Any Ideas?

Ray Simpson

 

Re:String Grid Question...


I forgot to mention that this example assumes no fixed rows. If you have
fixed rows then simply adjust the index of the RowHeights property.

Quote
Carl Caulkett wrote:

> Hi Ray,

> One possibility is to hide the first row using ...

> MyStringGrid.RowHeights[0] := 0;

---8<---

Re:String Grid Question...


Hi Ray,

One possibility is to hide the first row using ...

MyStringGrid.RowHeights[0] := 0;

The first row can be restored to normal using ...

MyStringGrid.RowHeights[0] := MyStringGrid.DefaultRowHeight;

While the row is hidden, you may have to take appropriate action if the
grid receives focus.

Cheers,
Carl

Quote
Ray Simpson wrote:

> I have a basic TStringGrid.  I use it to store properties of media objects.
> If there is no properties, how do I make it so there is no rows in the grid.
> IT always defaults to 1 row no matter what.  Any Ideas?

> Ray Simpson

Re:String Grid Question...


Ray -

TStringGrids insist on having one data row at all times. (They have to
have some place for the user to enter data.) Short of choosing a
different control, just nuke the contents and disable the control.

Good luck.

Kurt

Other Threads