summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2011-06-20 12:29:45 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2011-06-20 12:40:07 +0200
commit0998885ee825b18ec1a03a151193f4fa5d2d4f82 (patch)
treef56a68d3f9195f13ff8d02fd71b296d0e000e0bb
parent7848117fa8d118ae64555a40cf0cb178de1a98e9 (diff)
downloadfpGUI-0998885ee825b18ec1a03a151193f4fa5d2d4f82.tar.xz
bug: a scrolled grid with smoothscroll enabled did not allow columns to be resized.
- My calculations was totally out of wack! Now it works as it should. - Also made sure scrollbars are correctly updated if Beginupdate..Endupdate is used.
-rw-r--r--src/gui/fpg_basegrid.pas27
-rw-r--r--src/gui/fpg_grid.pas5
2 files changed, 9 insertions, 23 deletions
diff --git a/src/gui/fpg_basegrid.pas b/src/gui/fpg_basegrid.pas
index 6f9de311..509fb3ff 100644
--- a/src/gui/fpg_basegrid.pas
+++ b/src/gui/fpg_basegrid.pas
@@ -1059,15 +1059,13 @@ begin
begin
inc(cw, ColumnWidth[n]);
// Resizing is enabled 4 pixel either way of the cell border
- if ((x >= (cLeft+cw-4)) and (x <= (cLeft+cw+4))) {or
- (cw > (cLeft + VisibleWidth)) and (x >= (cLeft + VisibleWidth-4))} then
+ if ((x >= (cLeft+cw-4)) and (x <= (cLeft+cw+4))) then
begin
colresize := True;
Break;
end;
-
- if cw > VisibleWidth then
- Break;
+ { TODO: We could optimize this slightly by breaking as soon as x is
+ greater than current column edge we are over. }
end; { if }
end; { if/else }
@@ -1142,21 +1140,10 @@ begin
FColResizing := True;
FResizedCol := n;
FDragPos := x;
- Break;
- //end
- //else if (cw > cLeft+VisibleWidth) and (x >= cLeft+VisibleWidth-4) then
- //begin
- // FColResizing := True;
- // FResizedCol := n;
- // FDragPos := x;
- // nw := ColumnWidth[FResizedCol] - (cw+cLeft-x);
- // if nw > 0 then
- // SetColumnWidth(FResizedCol, nw );
- // Break;
+ Exit;
end; { if/else }
-
- if cw > VisibleWidth then
- Break;
+ { TODO: We could optimize this slightly by breaking as soon as x is
+ greater than current column edge we are over. }
end; { for }
end
else
@@ -1320,7 +1307,7 @@ procedure TfpgBaseGrid.Update;
begin
if csUpdating in ComponentState then
Exit;
- FollowFocus;
+ UpdateScrollBars;
RePaint;
end;
diff --git a/src/gui/fpg_grid.pas b/src/gui/fpg_grid.pas
index 9b3d6f20..7e5e1e51 100644
--- a/src/gui/fpg_grid.pas
+++ b/src/gui/fpg_grid.pas
@@ -82,8 +82,6 @@ type
end;
- { TfpgCustomStringGrid }
-
TfpgCustomStringGrid = class(TfpgCustomGrid)
private
function GetCell(ACol, ARow: Integer): string;
@@ -409,7 +407,8 @@ begin
if ACol > ColumnCount-1 then
Exit; //==>
BeginUpdate;
- TfpgStringColumn(FColumns.Items[ACol]).Width := AValue;
+ inherited SetColumnWidth(ACol, AValue);
+// TfpgStringColumn(FColumns.Items[ACol]).Width := AValue;
EndUpdate;
end;