Recent

Author Topic: Adding strings to a stringgrid  (Read 18579 times)

MarkAshley

  • Guest
Adding strings to a stringgrid
« on: May 24, 2005, 09:13:59 pm »
Hi there

I'm trying Lazarus as an alternative to Delphi and am having a problem adding strings to a stringgrid. In Delphi I use something like:

stringgrid1.rows[0][0]:='hello';

This would set the top left most cell to 'hello'. This doesn't work in Lazarus. I don't get any errors when I compile, but the lable does not appear on the stringgrid. Can anybody help me?

Thanks
Mark

jesusr

  • Sr. Member
  • ****
  • Posts: 499
Re: Adding strings to a stringgrid
« Reply #1 on: May 24, 2005, 11:00:12 pm »
Quote from: "MarkAshley"
Hi there

I'm trying Lazarus as an alternative to Delphi and am having a problem adding strings to a stringgrid. In Delphi I use something like:

stringgrid1.rows[0][0]:='hello';

This would set the top left most cell to 'hello'. This doesn't work in Lazarus. I don't get any errors when I compile, but the lable does not appear on the stringgrid. Can anybody help me?

Thanks
Mark


you can get a small explanation here: http://lazarus-ccr.sourceforge.net/kb/index.php/Grids_Reference_Page#property_Rows.5Bindex:_Integer.5D:_TStrings_read_GetRows_write_SetRows.3B

you could get the same effect with stringgrid1.cells[0,0] := 'hello', what are you trying to do?

Jesus Reyes A.

glober

  • Full Member
  • ***
  • Posts: 130
Re: Adding strings to a stringgrid
« Reply #2 on: May 25, 2005, 02:14:39 am »
Quote from: "jesusr"

you can get a small explanation here: http://lazarus-ccr.sourceforge.net/kb/index.php/Grids_Reference_Page#property_Rows.5Bindex:_Integer.5D:_TStrings_read_GetRows_write_SetRows.3B



This is a bit off topic, but since it's some interesting information, I'm curious how you got to the above page? I went to http://lazarus-ccr.sourceforge.net/kb/index.php/Main_Page and coul not find a link to the page you mentioned?

jesusr

  • Sr. Member
  • ****
  • Posts: 499
Adding strings to a stringgrid
« Reply #3 on: May 25, 2005, 07:07:43 am »
I started the page but the lack of time is keeping out of updating the grids documentation.

It's not linked to main page or any other pages (well it's linked in my user page) because there is not yet many information or complete information. Can be found through

special pages->all pages->grids reference page.  

Jesus Reyes A.

Anonymous

  • Guest
Adding strings to a stringgrid
« Reply #4 on: May 25, 2005, 10:39:03 am »
Thanks for the info. I can now change the strings in the grid. One more question - how can I delete a row from the grid? I used to use the TGridCracker class in Delphi.

Thanks
Mark

jesusr

  • Sr. Member
  • ****
  • Posts: 499
Adding strings to a stringgrid
« Reply #5 on: May 25, 2005, 06:32:53 pm »
StringGrid1.DeleteColRow(false, ColumnToDelete); // False=Row, True=Column

jesusr

  • Sr. Member
  • ****
  • Posts: 499
Adding strings to a stringgrid
« Reply #6 on: May 25, 2005, 06:34:24 pm »
er... should be Row_number_To_Delete  ;)

Anonymous

  • Guest
Adding strings to a stringgrid
« Reply #7 on: May 26, 2005, 10:19:13 am »
Quote from: "jesusr"
er... should be Row_number_To_Delete  ;)
EXCELLENT!!

Thank you :)

Mark

 

TinyPortal © 2005-2018