BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Synchronize TListViews

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL)
View previous topic :: View next topic  
Author Message
Loekie
Guest





PostPosted: Sat Jan 13, 2007 12:44 am    Post subject: Synchronize TListViews Reply with 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 (loekj (AT) loekje (DOT) nl)
Loek
Back to top
Guest






PostPosted: Wed Jan 17, 2007 9:11 am    Post subject: Re: Synchronize TListViews Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.