From 6edfa51c216a77b3411bf993f2e46d491ded4eea Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Sat, 18 Feb 2006 23:00:09 +0000 Subject: [PATCH] MakeVisible implemented Originally committed to SVN as r66. --- core/base_grid.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/base_grid.cpp b/core/base_grid.cpp index 4a3d63e51..562b61311 100644 --- a/core/base_grid.cpp +++ b/core/base_grid.cpp @@ -134,6 +134,21 @@ void BaseGrid::EndBatch() { ////////////////////// // Makes cell visible void BaseGrid::MakeCellVisible(int row, int col) { + // Get size + int w = 0; + int h = 0; + GetClientSize(&w,&h); + bool forceCenter = true; + + // Get min and max visible + int minVis = yPos+1; + int maxVis = yPos+h/lineHeight-3; + + // Make visible + if (forceCenter || row < minVis || row > maxVis) { + yPos = MID(0,row - h/lineHeight/2 + 1,GetRows()+2 - h/lineHeight); + scrollBar->SetThumbPosition(yPos); + } }