From d17987e01bb0cff405808c714ba8b530db0d3383 Mon Sep 17 00:00:00 2001 From: skalogryz Date: Tue, 25 Nov 2014 04:04:40 +0000 Subject: [PATCH] richmemo: making load function compatible with earlier version of lazarus git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3775 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/richmemo/richmemoutils.pas | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/components/richmemo/richmemoutils.pas b/components/richmemo/richmemoutils.pas index 1c2b0c158..23010c7ba 100644 --- a/components/richmemo/richmemoutils.pas +++ b/components/richmemo/richmemoutils.pas @@ -65,6 +65,7 @@ begin Result:=InsertImageFromFile(ARichMemo, APos, FileNameUTF8, NoResize); end; +{$IFDEF USELCLUtf8} procedure LoadRTFFile(const ARichMemo: TCustomRichMemo; const FileNameUTF8: string); var fs : THandleStream; @@ -80,6 +81,21 @@ begin end; FileClose(h); end; +{$ENDIF} + +procedure LoadRTFFile(const ARichMemo: TCustomRichMemo; const FileNameUTF8: string); +var + fs : TFileStream; +begin + if not Assigned(ARichMemo) then Exit; + fs:= TFileStream.Create( UTF8Decode(FileNameUTF8), fmShareDenyNone or fmOpenRead); + try + ARichMemo.LoadRichText(fs); + finally + fs.Free; + end; +end; + initialization if not Assigned(InsertImageFromFile) then