Recent

Author Topic: TStringGrid not working properly  (Read 10363 times)

LinuxSmiley

  • Guest
TStringGrid not working properly
« on: August 02, 2005, 10:53:58 am »
Hi there!

I'm currently trying to write my first application with Lazarus (after using Delphi for years) and I have one real big problem:

I first tried to use VirtualTreeView but as that didn't show any column titles I tried to use TStringGrid ... but there's the same problem. No matter if I set up the columns with the GUI or at runtime, the column titles are never shown. When I enable column resizing, the resized column isn't shown either - StringGrid1.Refresh; doesn't help but minimizing and restoring the whole application works :?

Who can give me a hint on what I'm doing wrong?

Anonymous

  • Guest
TStringGrid not working properly
« Reply #1 on: August 02, 2005, 08:19:06 pm »
Have you tried with

StringGrid1.Cells[x,0] := 'MyTitle';
StringGrid1.ColWidths
  • := 300;



where x is the column number?
This work for me.

Cristiano

jesusr

  • Sr. Member
  • ****
  • Posts: 499
Re: TStringGrid not working properly
« Reply #2 on: August 03, 2005, 02:11:59 am »
Quote from: "LinuxSmiley"
Hi there!

I'm currently trying to write my first application with Lazarus (after using Delphi for years) and I have one real big problem:

I first tried to use VirtualTreeView but as that didn't show any column titles I tried to use TStringGrid ... but there's the same problem. No matter if I set up the columns with the GUI or at runtime, the column titles are never shown. When I enable column resizing, the resized column isn't shown either - StringGrid1.Refresh; doesn't help but minimizing and restoring the whole application works :?

Who can give me a hint on what I'm doing wrong?


Your are right, this feature is not yet implemented, TCustomGrid.Columns are the base to implement dbgrid.columns, in dbgrid usually one have only fixed row, the columns title. But in normal grids one can have at design time any amount of fixed rows, I was having problems deciding how to handle this.

In the mean time you can do as Cristiano wrote, changing at run time the cell content, OR use the stringgrid editor at design time, right click the grid and then choose StringGrid Editor. You can write directly any text in any cell

if you want to clear the grid without having to reset the title column text, use the stringgrid.clean methods: see the currently yet-to-be-finished grid reference for help: http://wiki.lazarus.freepascal.org/index.php/Grids_Reference_Page

Anonymous

  • Guest
TStringGrid not working properly
« Reply #3 on: August 03, 2005, 03:34:44 pm »
Thanks for the answers, I'm now able to set (and see!) the column titles. Keep up the great work!

 

TinyPortal © 2005-2018