View Issue Details

IDProjectCategoryView StatusLast Update
0019624Lazarus CCR-public2011-10-14 19:31
ReporterHeinrich Wolf Assigned ToVincent Snijders  
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionduplicate 
Summary0019624: TRichMemo does not save to nor load from a file on Linux with GTK2
DescriptionHello,

I would like to create an RTF file on hard disk without user input. To do this, I installed RichMemo from „svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/richmemo/“. On Linux I had to apply the patch from http://bugs.freepascal.org/view.php?id=17319 to be able to install it. Consecutively I append formatted text pieces to a hidden RichMemo and then write it's content to a FileStream. On Windows that works, but on Linux I always get an empty file, although I see the correct content in the RichMemo.

1st problem (solved):
If I set visible := false, then the RichMemo does not accept text. Instead I keep visible := True and cover the RichMemo with a Panel.

2nd problem (Linux only, solved):
RichMemo.SelStart := RichMemo.GetTextLen;
RichMemo.SelText := s;
only works on Windows, but not on Linux. Instead I use
RichMemo.Text := RichMemo.Text + s;
But then I lose all formatting so far. So I collect all formatting in a TList and apply them not before all concatenations are done.

3rd problem (solved):
I pass UTF8 encoded text pieces.
RichMemo.GetTextLen
returns numbers, which are not suitable for setting the range of formatting. Instead I maintain my own length:
Inc(RichLen, UTF8Length(s));

4th problem, not solved, please help!
This code to save the text in a file only works on Windows. In Linux I always get an empty file.
Stream := TFileStream.Create(SaveDialog.FileName, fmCreate);
RichMemo.SaveRichText(Stream);
Stream.Free;

I already posted these questions in http://www.lazarusforum.de/viewtopic.php?f=18&t=5110 . Someone answered that the code for SaveRichText in GTK2 does not yet exist.

I created an RTF file with the samples/testsimple projekt on Windows and tried to load this file with the samples/testsimple projekt on Linux. But then I get an empty window. Maybe the code for LoadRichText in GTK2 also does not yet exist.

kind regards
Heiner
TagsNo tags attached.
WidgetsetGTK 2
Attached Files

Relationships

duplicate of 0015894 resolvedDmitry Boyarintsev Trichmemo on GTK2 wouldn't save or load richtext 

Activities

Heinrich Wolf

2011-06-27 20:30

reporter   ~0049458

Hello,

In
http://www.lazarusforum.de/viewtopic.php?f=18&t=5110
I was notified, that this is duplicate to
http://bugs.freepascal.org/view.php?id=15894

kind regards
Heiner

Issue History

Date Modified Username Field Change
2011-06-24 23:01 Heinrich Wolf New Issue
2011-06-24 23:01 Heinrich Wolf Widgetset => GTK 2
2011-06-27 20:30 Heinrich Wolf Note Added: 0049458
2011-10-14 19:31 Vincent Snijders Relationship added duplicate of 0015894
2011-10-14 19:31 Vincent Snijders Status new => resolved
2011-10-14 19:31 Vincent Snijders Resolution open => duplicate
2011-10-14 19:31 Vincent Snijders Assigned To => Vincent Snijders