diff --git a/lcl/include/control.inc b/lcl/include/control.inc index 8919a7c58f..fa0045c922 100644 --- a/lcl/include/control.inc +++ b/lcl/include/control.inc @@ -3147,11 +3147,13 @@ begin Perform(CM_TEXTCHANGED, 0, 0); end; -{------------------------------------------------------------------------------} -{ TControl SetText } -{------------------------------------------------------------------------------} +{------------------------------------------------------------------------------ + TControl SetText +------------------------------------------------------------------------------} procedure TControl.SetText(const Value: TCaption); begin + //if CompareText(ClassName,'TMEMO')=0 then + // debugln('TControl.SetText A ',DbgSName(Self),' GetText="',GetText,'" Value="',Value,'" FCaption="',FCaption,'"'); if GetText = Value then Exit; // Check if SetTextBuf is overridden, otherwise @@ -3169,11 +3171,13 @@ begin DebugLn('Note: SetTextBuf is overridden for: ', Classname); SetTextBuf(PChar(Value)); end; + //if CompareText(ClassName,'TMEMO')=0 then + // debugln('TControl.SetText END ',DbgSName(Self),' FCaption="',FCaption,'"'); end; -{------------------------------------------------------------------------------} -{ TControl Update } -{------------------------------------------------------------------------------} +{------------------------------------------------------------------------------ + TControl Update +------------------------------------------------------------------------------} procedure TControl.Update; begin if Parent<>nil then Parent.Update; @@ -3456,6 +3460,9 @@ end; { ============================================================================= $Log$ + Revision 1.228 2005/01/01 14:38:36 mattias + fixed loading TMemo.Lines - During Loading + Revision 1.227 2004/12/22 23:54:21 mattias started TControl.AnchorSide diff --git a/lcl/include/custommemo.inc b/lcl/include/custommemo.inc index d49db134f3..62d46a7132 100644 --- a/lcl/include/custommemo.inc +++ b/lcl/include/custommemo.inc @@ -34,7 +34,7 @@ begin TMemoStrings(FLines).MemoWidgetClass := TWSCustomMemoClass(WidgetSetClass); FVertScrollbar := TMemoScrollBar.Create(Self, sbVertical); FHorzScrollbar := TMemoScrollBar.Create(Self, sbHorizontal); - SetInitialBounds(0,0,185,90); + SetInitialBounds(0,0,150,90); end; {------------------------------------------------------------------------------ @@ -49,7 +49,7 @@ begin FreeThenNil(FLines); FreeThenNil(FVertScrollbar); FreeThenNil(FHorzScrollbar); - inherited destroy; + inherited Destroy; end; {------------------------------------------------------------------------------ @@ -178,6 +178,9 @@ end; { ============================================================================= $Log$ + Revision 1.32 2005/01/01 14:38:36 mattias + fixed loading TMemo.Lines - During Loading + Revision 1.31 2004/11/15 12:37:52 mattias added check handleallocated on loading memo diff --git a/lcl/include/memostrings.inc b/lcl/include/memostrings.inc index b0534508af..90f86e6f4a 100644 --- a/lcl/include/memostrings.inc +++ b/lcl/include/memostrings.inc @@ -110,7 +110,7 @@ end; Returns: ------------------------------------------------------------------------------} -procedure TMemoStrings.Insert(index : Integer; const S: String); +procedure TMemoStrings.Insert(Index: Integer; const S: String); var TempStrings: TStringList; Cnt: Integer; @@ -123,11 +123,18 @@ begin CurText := FMemo.Text; TempStrings.Text := CurText; Cnt:=TempStrings.Count; + //debugln('TMemoStrings.Insert A Index=',dbgs(Index),' Cnt=',dbgs(Cnt),' S="',S,'" FMemo.HandleAllocated=',dbgs(FMemo.HandleAllocated)); if Index=Cnt then begin - if FMemo.HandleAllocated then begin + // IMPORTANT: + // TControl.FCaption is only updated with FMemo.Text:=s calls + // That's why, FMemoWidgetClass.AppendText does not update + // TControl.FCaption and can not be used during loading. + if (FMemo.HandleAllocated) and (not (csLoading in FMemo.ComponentState)) + then begin LastLine:=S+LineEnding; if (CurText<>'') and (not (CurText[length(CurText)] in [#10,#13])) then LastLine:=LineEnding+LastLine; + //debugln('TMemoStrings.Insert AppendText LastLine="',LastLine,'"'); FMemoWidgetClass.AppendText(FMemo, LastLine); end else begin TempStrings.Insert(Index, S); @@ -148,6 +155,9 @@ end; { ============================================================================= $Log$ + Revision 1.12 2005/01/01 14:38:36 mattias + fixed loading TMemo.Lines - During Loading + Revision 1.11 2004/09/10 17:59:57 micha convert LM_APPENDTEXT to interface method diff --git a/lcl/interfaces/gtk/gtkwscontrols.pp b/lcl/interfaces/gtk/gtkwscontrols.pp index 5973b61a6f..1210b9b18b 100644 --- a/lcl/interfaces/gtk/gtkwscontrols.pp +++ b/lcl/interfaces/gtk/gtkwscontrols.pp @@ -399,12 +399,13 @@ begin csMemo : begin P:= GetWidgetInfo(P, True)^.CoreWidget; - + //debugln('TGtkWSWinControl.SetText A ',dbgs(gtk_text_get_length(PGtkText(P))),' AText="',AText,'"'); gtk_text_freeze(PGtkText(P)); gtk_text_set_point(PGtkText(P), 0); gtk_text_forward_delete(PGtkText(P), gtk_text_get_length(PGtkText(P))); gtk_text_insert(PGtkText(P), nil, nil, nil, pLabel, -1); gtk_text_thaw(PGtkText(P)); + //debugln('TGtkWSWinControl.SetText B ',dbgs(gtk_text_get_length(PGtkText(P)))); end; csPage: diff --git a/lcl/interfaces/gtk/gtkwsstdctrls.pp b/lcl/interfaces/gtk/gtkwsstdctrls.pp index a1a0d9f963..b42966e0df 100644 --- a/lcl/interfaces/gtk/gtkwsstdctrls.pp +++ b/lcl/interfaces/gtk/gtkwsstdctrls.pp @@ -854,8 +854,10 @@ begin Widget:=GetWidgetInfo(Pointer(ACustomMemo.Handle), true)^.CoreWidget; gtk_text_freeze(PGtkText(Widget)); CurMemoLen := gtk_text_get_length(PGtkText(Widget)); + //debugln('TGtkWSCustomMemo.AppendText "',AText,'" CurMemoLen=',dbgs(CurMemoLen)); gtk_editable_insert_text(PGtkOldEditable(Widget), PChar(AText), Length(AText), @CurMemoLen); + //debugln('TGtkWSCustomMemo.AppendText B CurMemoLen=',dbgs(CurMemoLen)); gtk_text_thaw(PGtkText(Widget)); end;