RichMemo - Open and SaveDialog lazarus / 13-General ---------------------------------------------------------------------- MarcysPL · 2010-12-05 10:08 Hi! This is my first post, so be welcome. I have a problem with a component RichMemo. I have a 2 Buttons, OpenDialog and SaveDialog and RichMemo. And here the question is what made the source code to work SaveDialog and OpenDialog with RichMemo? As in the case of Memo: Code: [Select]If then opendialog.execute Memo1.Lines.OpenFromFile (opendialog1.filename);or Code: [Select]if savedialog1.execute then Memo1.Lines.savetofile (savedialog1.filename);Please answer quickly, thank you P.S I'm Polish, so I this post translated by Google Translate ---------------------------------------------------------------------- DirkS · 2010-12-05 10:49 I assume you're referring to the RichMemo component from Lazarus CCR. There's an example project in the folder samples\testsimple which also shows how to load / save text using streams: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button4Click(Sender: TObject);var  fs : TFileStream;begin  if SaveDialog1.Execute then begin    fs := nil;    try      fs := TFileStream.Create( Utf8ToAnsi(SaveDialog1.FileName), fmCreate);      RichMemo1.SaveRichText(fs);    except    end;    fs.Free;  end;end; procedure TForm1.Button5Click(Sender: TObject);var  fs : TFileStream;begin  if OpenDialog1.Execute then begin    fs := nil;    try      // Utf8ToAnsi is required for windows      fs := TFileStream.Create(Utf8ToAnsi(OpenDialog1.FileName), fmOpenRead or fmShareDenyNone);      RichMemo1.LoadRichText(fs);    except    end;  fs.Free;  end;end;  Gr. Dirk. ---------------------------------------------------------------------- MarcysPL · 2010-12-05 10:58 Thanks, but I found problem If I click on the button (open dialog or savedialog) show me the error message Code: [Select]Project project1.exe raised excepton class 'External: SIGSEGV'then Code: [Select]Access violation. Click Ok to kill ...Please help! DirkS this code is very good, thanks but this problem... P.S I used Lazarus 0.9.28.2 beta. I have Windows Vista Home Premium 64-bit ---------------------------------------------------------------------- skalogryz · 2010-12-05 15:36 MarcysPL, could you provide an example? ---------------------------------------------------------------------- MarcysPL · 2010-12-06 16:17 Ok, I have on the form 2 buttons, open dialog, savedialog and RichMemo. I want save text from RichMemo in file *.rtf I writed in filters and defaultExt *.rtf... Ok, is good, I compiled and runned this application (name: project1.exe). ...And... BIG Problem! I clicked button1 (save text [savedialog1]) and... error! Code: [Select]Project project1.exe raised excepton class 'External: SIGSEGV'I don't know... I really want save the text, but this error. ---------------------------------------------------------------------- Bart · 2010-12-06 17:57 Try running the executable from the commandline (or double click it in explorer), there is (was) an issue with the debugger and Open/Save dialogs. (If you run the program from within the IDE, it will be run in the debugger (default: gdb.exe)). Bart