Recent

Author Topic: TStringGrid & Row number  (Read 10473 times)

airpas

  • Full Member
  • ***
  • Posts: 179
TStringGrid & Row number
« on: March 24, 2014, 07:25:31 am »
Hi
how to fill the first column with numbers automatically , starting from 1 to RowCount ?

thanks

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: TStringGrid & Row number
« Reply #1 on: March 24, 2014, 08:52:55 am »
There's property for this: TStringGrid.Options-> goFixedRowNumbering
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

airpas

  • Full Member
  • ***
  • Posts: 179
Re: TStringGrid & Row number
« Reply #2 on: March 24, 2014, 10:44:17 am »
thanks Blaazn
but seems setting a large number of rows caused a poor performance .
for example 1million rows , slow down the execution time by (in my pc 2 second) and eat 120Mb of memory .

MSEGUI seems much optimized , the same example execute faster and eat only 20Mb


karaba

  • New Member
  • *
  • Posts: 49
Re: TStringGrid & Row number
« Reply #3 on: March 24, 2014, 11:12:37 am »
err How many rows do you have? 120MB just by enabling one option? Are you sure?

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: TStringGrid & Row number
« Reply #4 on: March 24, 2014, 11:48:24 am »
err How many rows do you have? 120MB just by enabling one option? Are you sure?
The OP already said "1million rows"

karaba

  • New Member
  • *
  • Posts: 49
Re: TStringGrid & Row number
« Reply #5 on: March 24, 2014, 11:52:51 am »
err How many rows do you have? 120MB just by enabling one option? Are you sure?
The OP already said "1million rows"

Oops speed reading and meased it sorry.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: TStringGrid & Row number
« Reply #6 on: March 24, 2014, 12:08:41 pm »
Who wants to display 1 million rows in a standard grid? AFAIR the grid wasn't designed for this and you'd need to have a custom virtual grid that saves/loads data to be displayed on the fly...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: TStringGrid & Row number
« Reply #7 on: March 24, 2014, 01:05:07 pm »
Who wants to display 1 million rows in a standard grid?
I don't know.

AFAIR the grid wasn't designed for this
RowCount being of type integer implies that you can use any integer value. One million is, relatively speaking, a small number compared to MaxInt (2147483647)  :P

and you'd need to have a custom virtual grid that saves/loads data to be displayed on the fly...
I agree.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: TStringGrid & Row number
« Reply #8 on: March 24, 2014, 01:15:24 pm »
AFAIR the grid wasn't designed for this
RowCount being of type integer implies that you can use any integer value. One million is, relatively speaking, a small number compared to MaxInt (2147483647)  :P
Well yes, the OP indicates it does seem to work... for a given definition of "work" i.e. depending on your performance requirements ;)
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

airpas

  • Full Member
  • ***
  • Posts: 179
Re: TStringGrid & Row number
« Reply #9 on: March 24, 2014, 02:33:46 pm »
it is just a notice come from a simple test.
there should be a limit of row counts , since 1million caused notable slowdown  and as engkin said , RowCount is an integer type so it maybe more than millions .

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: TStringGrid & Row number
« Reply #10 on: March 24, 2014, 02:40:06 pm »
err How many rows do you have? 120MB just by enabling one option? Are you sure?

For visualisation of such huge amound of data you can use TVirtualStringTree. TStringGrid isn't right component to do that.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: TStringGrid & Row number
« Reply #11 on: March 24, 2014, 02:41:01 pm »
there should be a limit of row counts
Are you sure?

Patches welcome... would be interested to see how you intend to calculate that limit (especially given the speed differences between e.g. aRaspberry Pi versus multiple core desktop machines)... or whether you want to have a constant number.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

tk

  • Sr. Member
  • ****
  • Posts: 361
Re: TStringGrid & Row number
« Reply #12 on: April 07, 2014, 10:06:31 am »
Maybe the KGrid could help you with the goVirtualGrid option.
http://tkweb.eu/en/delphicomp/kgrid.html
You can generate the numbers yourself in the OnDrawCell event and this will be fast even for millions of lines.

TK.

 

TinyPortal © 2005-2018