 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Loekie Guest
|
Posted: Sat Jan 13, 2007 12:44 am Post subject: Synchronize TListViews |
|
|
Hello I'm trying to tie two ListViews together so that when the user scrolls
one, the other stays 'in sync'. I've really no idea how to do this because I
cannot find any Scroll information.
Please give me a hand
Thanks (loekj (AT) loekje (DOT) nl)
Loek |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Jan 17, 2007 9:11 am Post subject: Re: Synchronize TListViews |
|
|
try this:
int precr=0;
void __fastcall TForm1::ListView1AdvancedCustomDraw(
TCustomListView *Sender, const TRect &ARect, TCustomDrawStage
Stage,
bool &DefaultDraw)
{
int r;
TPoint P;
r=ListView1->TopItem->Index;
P=ListView1->TopItem->Position;
if (r>precr) P.y=P.y;
if (r<precr) P.y=-P.y;
if (r==precr) P.y=0;
ListView2->Scroll(P.x,P.y);
precr=r;
}
I suppose that you have 2 TListView called ListView1 and ListView2.
ListView1 is the "Master". ListView2 follow ListView1.
In this example I used a global variable (precr) only for semplicity:
you can define a private field.
I used the ListView1AdvancedCustomDraw because is always fired when
scrollbar moves. You can change it.
I tested the code for a ListView in vsReport mode.
On 12 Gen, 19:44, "Loekie" <l...@loekje.nl> wrote:
| Quote: | Hello I'm trying to tie two ListViews together so that when the user scrolls
one, the other stays 'in sync'. I've really no idea how to do this because I
cannot find any Scroll information.
Please give me a hand
Thanks (l...@loekje.nl)
Loek |
|
|
| 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
|
|