summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/fpg_basegrid.pas16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/gui/fpg_basegrid.pas b/src/gui/fpg_basegrid.pas
index 5ed95ab4..2df7b414 100644
--- a/src/gui/fpg_basegrid.pas
+++ b/src/gui/fpg_basegrid.pas
@@ -738,16 +738,18 @@ var
function ColMax: integer;
var
- i : integer;
+ i: integer;
+ w: integer;
begin
- i := 0;
- result := ColumnCount;
- while i < HWidth do
+ w := 0;
+ Result := 0;
+ for i := 0 to ColumnCount-1 do
begin
- dec(result);
- i := i + ColumnWidth[result];
+ w := w + ColumnWidth[i];
+ if w > Width then
+ inc(Result);
end;
- inc(result);
+ inc(Result);
end;
begin