 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Peter Guest
|
Posted: Thu Dec 18, 2003 11:19 am Post subject: TListView virtual and StartUpdate() and EndUpdate() |
|
|
Hi,
I used to use TListView non virtual and while I added all objects to the
list I made sure the 'adding itself' was not shown by calling StartUpdate()
and EndUpdate()
I now changed to a virtual approach to be able to show many objects very
fast but StartUpdate() and EndUpdate() don't work anymore now.
Each time the objects are shown and OnData is called you see the objects
being added one by one.
Is there something I can do to make it look like the old approach again,
where the objects are shown all at once ?
|
|
| Back to top |
|
 |
René Wilhelmy Guest
|
Posted: Thu Dec 18, 2003 3:31 pm Post subject: Re: TListView virtual and StartUpdate() and EndUpdate() |
|
|
Hi,
Using the virtual approach give more control but still more tricky to
use. I can suggest you this to do some tests around the following:
-Set the property OwnerDraw to false (and of course OwnerData to true)
-Don't use the OnDrawItem. Use the OnCustomDrawItem instead (or maybe
for more control the OnAdvancedCustomDrawItem)
-use OnDataHint to update a range (or all)of items (instead of only
update your items via the OnData) to speed up the virtual list update.
-Once your EndUpdate() called, call the Repaint()
Rene Wilhelmy
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Dec 18, 2003 7:02 pm Post subject: Re: TListView virtual and StartUpdate() and EndUpdate() |
|
|
"Peter" <Peter (AT) Smart-Projects (DOT) net> wrote
| Quote: | Each time the objects are shown and OnData is called you see
the objectsbeing added one by one.
|
Are you still calling Add(), by chance? If so, you should not be. For a
virtual ListView, you are supposed to be storing your data *external* to the
ListView. To add (or remove) items, you simply set the Items->Count
property to the new number of items. Nothing else. Do not call Add(). No
Begin/EndUpdate() needed.
Gambit
|
|
| Back to top |
|
 |
Martin Moeller Guest
|
Posted: Thu Dec 18, 2003 7:12 pm Post subject: Re: TListView virtual and StartUpdate() and EndUpdate() |
|
|
But it still would flicker, and what to do about that?
Tks & Rgds, Martin
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Dec 18, 2003 7:31 pm Post subject: Re: TListView virtual and StartUpdate() and EndUpdate() |
|
|
"Martin Moeller" <martin.moeller (AT) moema (DOT) it> wrote
| Quote: | But it still would flicker, and what to do about that?
|
When you set the Count, you *do not* call Begin/Update() at all. If fact,
under virtual mode, there is almost never a need to use Begin/EndUpdate() at
all anymore.
Gambit
|
|
| Back to top |
|
 |
Peter Guest
|
Posted: Fri Dec 19, 2003 1:15 pm Post subject: Re: TListView virtual and StartUpdate() and EndUpdate() |
|
|
No I don't use Ad() anymore.
I still have Begin/EndUpdate() 'around' the routine that finds all objects
and sets count and so on.
I can remove Begin/EndUpdate() altogether so it seems.
But the problem remains.
Now the objects are displayed one by one in the list view (very fast of
course but you see the difference with before where the objects would be
displayed all at once right after EndUpdate()).
So is there an (easy) way to prevent the objects from being displayed one by
one ?
"Remy Lebeau (TeamB)" <gambit47.no.spam (AT) no (DOT) spam.yahoo.com> wrote
| Quote: |
"Martin Moeller" <martin.moeller (AT) moema (DOT) it> wrote in message
news:3fe1fc1a$1 (AT) newsgroups (DOT) borland.com...
But it still would flicker, and what to do about that?
When you set the Count, you *do not* call Begin/Update() at all. If fact,
under virtual mode, there is almost never a need to use Begin/EndUpdate()
at
all anymore.
Gambit
|
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Fri Dec 19, 2003 7:49 pm Post subject: Re: TListView virtual and StartUpdate() and EndUpdate() |
|
|
"Peter" <Peter (AT) Smart-Projects (DOT) net> wrote
| Quote: | I still have Begin/EndUpdate() 'around' the routine that
finds all objects and sets count and so on.
|
You didn't need to use Begin/EndUpdate() at all in the first place, unless
you were making a bunch of changes to the items. If you are simply looking
through the items but not changing them, then Begin/EndUpdate() are not
needed. Likewise, if you are only changing 1 time, they are not needed,
either.
| Quote: | But the problem remains.
|
Please show your actual code. You are probably using the ListView wrong.
Gambit
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|