From c360255b3d0dd5a67b8d1f5d860656b3d4927400 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sat, 12 Jun 2010 13:32:45 +0200 Subject: TextEdit: fixed sync between textedit content and scrollbars. --- prototypes/textedit/fpg_textedit.pas | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/prototypes/textedit/fpg_textedit.pas b/prototypes/textedit/fpg_textedit.pas index 4cbaa996..0adfb821 100644 --- a/prototypes/textedit/fpg_textedit.pas +++ b/prototypes/textedit/fpg_textedit.pas @@ -460,6 +460,8 @@ begin if FLines.Count > 0 then FVScrollBar.SliderSize := FVisLines / FLines.Count; FVScrollBar.Visible := FLines.Count > FVisLines; + if FVScrollBar.Visible then + FVScrollBar.RepaintSlider; FHScrollBar.Min := 0; FHScrollBar.PageSize := FVisCols div 2; //FMaxScrollH div 4; @@ -467,8 +469,11 @@ begin FHScrollBar.Position := HPos; FHScrollBar.SliderSize := FVisCols / FMaxScrollH; FHScrollBar.Visible := FMaxScrollH > FVisCols; + if FHScrollBar.Visible then + FHScrollBar.RepaintSlider; -// UpdateScrollBarCoords; + UpdateScrollBarCoords; + UpdateCharBounds; end; procedure TfpgBaseTextEdit.VScrollBarMove(Sender: TObject; position: integer); @@ -522,7 +527,7 @@ var begin OldPos := VPos; VPos := p; - UpdateScrollBars; + {$IFDEF gDEBUG} writeln('OldPos:', OldPos, ' NewPos:', VPos, ' SB.Max:', FVScrollBar.Max); {$ENDIF} @@ -556,7 +561,7 @@ var begin OldPos := HPos; HPos := p; - UpdateScrollBars; + {$IFDEF gDEBUG} writeln('OldPos:', OldPos, ' NewPos:', HPos, ' SB.Max:', FHScrollBar.Max); {$ENDIF} @@ -588,11 +593,6 @@ begin VHeight := r.Height; HWidth := r.Width; - //if FVScrollBar.Visible then - //Dec(HWidth, FVScrollBar.Width); - //if FHScrollBar.Visible then - //Dec(VHeight, FHScrollBar.Height); - FHScrollBar.Top := Height - FHScrollBar.Height - r.Top; FHScrollBar.Left := r.Top; FHScrollBar.Width := HWidth; -- cgit v1.2.3-70-g09d2