summaryrefslogtreecommitdiff
path: root/docview/components/richtext
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2010-08-05 16:59:53 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2010-08-05 16:59:53 +0200
commit0c799a05c77e480da2609658af1edafec9633aa3 (patch)
tree8439ec7510639f327491456807c0d4c4fc1c7d47 /docview/components/richtext
parent9633e8b8c3fd68c631dbc10abd85ad96800d1657 (diff)
downloadfpGUI-0c799a05c77e480da2609658af1edafec9633aa3.tar.xz
RichTextView: Improved the scrollbar PageSize and SliderSize based on content displayed.
Diffstat (limited to 'docview/components/richtext')
-rw-r--r--docview/components/richtext/RichTextView.pas11
1 files changed, 7 insertions, 4 deletions
diff --git a/docview/components/richtext/RichTextView.pas b/docview/components/richtext/RichTextView.pas
index 5fa57ffc..becd50de 100644
--- a/docview/components/richtext/RichTextView.pas
+++ b/docview/components/richtext/RichTextView.pas
@@ -1181,7 +1181,7 @@ begin
// Calculate used and available width
AvailableWidth := GetTextAreaWidth;
- MaxDisplayWidth := FLayout.Width;
+ MaxDisplayWidth := FLayout.Width + 200; { TODO : We need to fix FLayout.Width first before we remove + 200 }
// Horizontal scroll setup
if MaxDisplayWidth > AvailableWidth then
@@ -1190,7 +1190,8 @@ begin
// FHScrollbar.SliderSize := AvailableWidth div 2;
FHScrollbar.Min := 0;
if FNeedHScroll then
- FHScrollbar.Max := MaxDisplayWidth
+ { TODO : As soon as we fix FLayout.Width, then we can enable the extra code below }
+ FHScrollbar.Max := (MaxDisplayWidth) // - AvailableWidth) + FScrollbarWidth
else
begin
FHScrollBar.Position := 0;
@@ -1212,9 +1213,11 @@ begin
end;
FHScrollBar.ScrollStep := 25; // pixels
- FHScrollBar.PageSize := AvailableWidth div 2;
+ FHScrollBar.PageSize := AvailableWidth - FHScrollbar.ScrollStep; // slightly less than width
+ FHScrollBar.SliderSize := AvailableWidth / MaxDisplayWidth;
FVScrollBar.ScrollStep := 25; // not used (line up/down calculated explicitly)
- FVScrollBar.PageSize := AvailableHeight div 2;
+ FVScrollBar.PageSize := AvailableHeight - FVScrollBar.ScrollStep;
+ FVScrollBar.SliderSize := AvailableHeight / FLayout.Height;
// Physical horizontal scroll setup
FHScrollbar.Visible := FNeedHScroll;