diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2009-08-27 17:15:41 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2009-08-27 17:18:19 +0200 |
commit | c5946c14e6517ed3c08aae4978d083ede6dc9d10 (patch) | |
tree | 6e09e64fdcf0a72116cbac4a7e19799e0c9da196 /extras/tiopf | |
parent | d329c6c4ba6dfdc4c6e241fd4bb306bb41ab60ff (diff) | |
download | fpGUI-c5946c14e6517ed3c08aae4978d083ede6dc9d10.tar.xz |
Fix the calculated last column width in StringGrid Mediator.
Signed-off-by: Graeme Geldenhuys <graeme@mastermaths.co.za>
Diffstat (limited to 'extras/tiopf')
-rw-r--r-- | extras/tiopf/gui/tiListMediators.pas | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/extras/tiopf/gui/tiListMediators.pas b/extras/tiopf/gui/tiListMediators.pas index 13fd4fcc..c0c5f5a5 100644 --- a/extras/tiopf/gui/tiListMediators.pas +++ b/extras/tiopf/gui/tiListMediators.pas @@ -453,8 +453,12 @@ procedure TStringGridMediator.CreateColumns; var i: integer; lColumnTotalWidth: integer; + lGridNonContentWidth: integer; + lLastColumnWidth: integer; begin lColumnTotalWidth := 0; + // Grid is 2px border left + right, 1px col gridline separator, 15px vertical scrollbar width + lGridNonContentWidth := 2 + 2 + (FieldsInfo.Count - 1) + 15; for i := 0 to FieldsInfo.Count - 1 do begin FView.ColumnWidth[i] := FieldsInfo[i].FieldWidth; @@ -463,11 +467,15 @@ begin //resize the last column to fill the grid. if i = FieldsInfo.Count - 1 then begin - if FView.Width > (lColumnTotalWidth + 10) then - FView.ColumnWidth[i] := FView.Width - (lColumnTotalWidth + 10); + if FView.Width > (lColumnTotalWidth + lGridNonContentWidth) then + begin + lLastColumnWidth := FView.Width - (lColumnTotalWidth + lGridNonContentWidth); + if lLastColumnWidth > 10 then + FView.ColumnWidth[i] := lLastColumnWidth; + end; end else - lColumnTotalWidth := lColumnTotalWidth + FView.ColumnWidth[i] + 20; + lColumnTotalWidth := lColumnTotalWidth + FView.ColumnWidth[i]; end; end; |