July 22nd, 2004, 09:34 AM
Working with 2 grids
I have 2 grids, which are in a way linked.
There can be lots of data in the grids, though they always have the same rowcount.
What I want my app to do, is when I go down enough rows that the scrollbar starts to move (or the TopLeftChanged event occurs), that BOTH my stringgrids uses the scroll bar so I can see the applicable data in both grids.
Just changing the selection on the other grids doesn't work.
This is what I tried
this doesn't work, as it is important that both the grids have the same visibility, but not really the same active cell (though not a bad thing).
TGridRect Temp = ((TStringGrid *)Sender)->Selection;
Grid1->Selection = Temp;
Grid2->Selection = Temp;
Can anyone help me?
July 22nd, 2004, 12:39 PM
Something like this perhaps?
The Delphi 6 equivalent of the above works for me, so I think it should work for you too.
Grid2->TopRow = Grid1->TopRow;
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
July 22nd, 2004, 02:39 PM
Just to add on what Scorpions4ever brought foreward;
Draw1->LeftCol = Draw2->LeftCol
* if you want to keep the horizontal scrollbars also sychronized.
July 26th, 2004, 02:07 AM
Haven't tried it though, but I am sure it'll work. Eventually I opted to display everything on one grid... it's not the same, as the data aren't *that* related, but I just changed the 'visible' property of the old grids to false for now, so it's not hard going back to the old way.