Article View: borland.public.cppbuilder.nativeapi
Article #1685Re: Best way to clear a stringgrid?
From: Remy Lebeau (TeamB)
Date: Fri, 29 Jun 2007 18:09
Date: Fri, 29 Jun 2007 18:09
33 lines
2314 bytes
2314 bytes
"Dan" <Dan@do.not.spam> wrote in message news:46854789.701@do.not.spam... > The above doesn't work. Indeed it creates the image that the gridis > cleared and it 'looks' like everything is gone, but simply set the > Row/Column count back again and you will see that the strings that were > entered into the grid are still there. Looking at the source code for TStringGrid, I do not see it ever shrinking the memory used for the Rows and Cols until the TStringGrid is destroyed. The memory only grows when needed. > Even the above though takes nearly 10 seconds to clear a Grid > containing 275K rows You should not be using a TStringGrid to display that many rows to begin with. It is not designed to handle large amounts of data. I would suggest using a virtual TListView instead (set the OwnerData property to True and use the OnData event). Then you can perform your own data management and optimize it for better speed and efficiency since the data is decoupled from the UI. > Am I wrong to expect that this clearing process should be possible > in less than a second? Yes. TStringGrid is not designed for large amounts of data. There is a lot of maintenance going on internally, so it is going to slow down the more data you put into it. Gambit
Technical Details
Message-ID:
<46854cd1$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder3.cambrium.nl!feeder6.cambrium.nl!feed.tweaknews.nl!xlned.com!feeder1.xlned.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4683bbbe$1@newsgroups.borland.com> <4683e2e7$1@newsgroups.borland.com> <46854789.701@do.not.spam>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,dbe415a5e9add767 X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <4683bbbe$1@newsgroups.borland.com> <4683e2e7$1@newsgroups.borland.com> <46854789.701@do.not.spam> Subject: Re: Best way to clear a stringgrid? Date: Fri, 29 Jun 2007 11:09:53 -0700 Lines: 35 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 75.82.252.126 Message-ID: <46854cd1$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1183141073 75.82.252.126 (29 Jun 2007 11:17:53 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder3.cambrium.nl!feeder6.cambrium.nl!feed.tweaknews.nl!xlned.com!feeder1.xlned.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail