diff --git a/components/richmemo/richmemo.pas b/components/richmemo/richmemo.pas index 6cab92689..310713c2a 100644 --- a/components/richmemo/richmemo.pas +++ b/components/richmemo/richmemo.pas @@ -340,7 +340,7 @@ type property ZoomFactor; end; -procedure InitFontParams(var p: TFontParams); +procedure InitFontParams(out p: TFontParams); function GetFontParams(styles: TFontStyles): TFontParams; overload; function GetFontParams(color: TColor; styles: TFontStyles): TFontParams; overload; function GetFontParams(const Name: String; color: TColor; styles: TFontStyles): TFontParams; overload; @@ -366,7 +366,7 @@ implementation uses {%H-}RichMemoFactory, WSRichMemo; -procedure InitFontParams(var p: TFontParams); +procedure InitFontParams(out p: TFontParams); begin FillChar(p, SizeOf(p), 0); end; @@ -835,7 +835,9 @@ function TCustomRichMemo.CanPaste: Boolean; begin if not HandleAllocated then HandleNeeded; if HandleAllocated then - Result:=TWSCustomRichMemoClass(WidgetSetClass).CanPasteFromClipboard(Self); + Result:=TWSCustomRichMemoClass(WidgetSetClass).CanPasteFromClipboard(Self) + else + Result:=false; end; procedure TCustomRichMemo.SetRangeColor(TextStart, TextLength: Integer; FontColor: TColor); @@ -1035,7 +1037,7 @@ begin if not HandleAllocated then HandleNeeded; if HandleAllocated and not TWSCustomRichMemoClass(WidgetSetClass).GetSubText(Self, TextStart, TextLength, false, isu, txt, utxt) then Exit; - if isu then Result:=UTF8Decode(utxt) + if isu then Result:=UTF8Encode(utxt) else Result:=txt; end; @@ -1050,7 +1052,7 @@ begin if HandleAllocated and not TWSCustomRichMemoClass(WidgetSetClass).GetSubText(Self, TextStart, TextLength, false, isu, txt, utxt) then Exit; if isu then Result:=utxt - else Result:=UTF8Encode(txt); + else Result:=UTF8Decode(txt); end; procedure TCustomRichMemo.SetSelLengthFor(const aselstr: string); @@ -1072,6 +1074,7 @@ function TCustomRichMemo.Search(const ANiddle: string; Start, Len: Integer; cons var so : TIntSearchOpt; begin + Result:=false; if not HandleAllocated then HandleNeeded; if HandleAllocated then begin so.len:=Len; @@ -1126,6 +1129,7 @@ begin if HandleAllocated then begin est.Pages:=TWSCustomRichMemoClass(WidgetSetClass).Print(Self, Printer, params, false); + Result:=true; end else Result:=false; end; diff --git a/components/richmemo/richmemohelpers.pas b/components/richmemo/richmemohelpers.pas index 91dfd8418..388c44ba0 100644 --- a/components/richmemo/richmemohelpers.pas +++ b/components/richmemo/richmemohelpers.pas @@ -209,11 +209,13 @@ function TRichEditParaAttributes.GetTab(Index: Byte): Integer; var m : TCustomRichMemo; stop : TTabStopList; + idx : integer; begin + idx:=Index; m:=TCustomRichMemo(TObject(Self)); m.GetParaTabs(m.SelStart, stop); - if (Index<0) or (Index>=stop.Count) then Result:=0 - else Result:=round(stop.Tabs[Index].Offset); + if (idx<0) or (idx>=stop.Count) then Result:=0 + else Result:=round(stop.Tabs[idx].Offset); end; function TRichEditParaAttributes.GetTabCount: Integer; @@ -263,13 +265,15 @@ procedure TRichEditParaAttributes.SetTab(Index: Byte; AValue: Integer); var m : TCustomRichMemo; stop : TTabStopList; + idx : integer; begin + idx:=Index; m:=TCustomRichMemo(TObject(Self)); m.GetParaTabs(m.SelStart, stop); - if (Index<0) or (Index>=stop.Count) then + if (idx<0) or (idx>=stop.Count) then Exit else begin - stop.Tabs[index].Offset:=AValue; + stop.Tabs[idx].Offset:=AValue; m.SetParaTabs(m.SelStart, m.SelLength, stop); end; end;