Editing Tmemo without starting new lines for each addition lazarus / 9-Editor ---------------------------------------------------------------------- tehmwak · 2009-04-13 05:10 Problem: procedure TForm1.examplebutton(Sender: TObject); begin memo1.text := memo1.text + 'example'; memo1.text := memo1.text + 'another example'; end;  Output expected: exampleanother example Actual output: example another example ... How would I go about getting my additions to stay on the same line? As in the expected output. ---------------------------------------------------------------------- tehmwak · 2009-04-14 11:57 Would I be correct in assuming that nobody can give me an answer? Not even a comment about my poorly worded post? Anything? ---------------------------------------------------------------------- Martin_fr · 2009-04-14 12:09 A memo always has a trailing new-line, there are several ways: you can use: memo1.Text:= copy(Memo1.Text, 1, length(Memo1.Text) - length(LineEnding)) + edit1.Text; or you can:   uses LCLProc; memo1.Text:= StripLN(Memo1.Text) + edit1.Text; ---------------------------------------------------------------------- tehmwak · 2009-04-14 12:26 I thank you good sir. I must however take the time to point out that this whole trailing- new-line-business is making porting a plethora of delphi applications a pain in the arse. Who decided to add such a thing? ---------------------------------------------------------------------- chrnobel · 2009-04-14 12:37 You could do something like this: Code: [Select]procedure TForm1.Button1Click(Sender: TObject); var   temptext:string; begin   temptext:=trimright(memo1.Text);   temptext:=temptext+edit1.Text;   memo1.Clear;   memo1.Text:=temptext; end; But why do you want the Memo to behave like this? /Christian ---------------------------------------------------------------------- tehmwak · 2009-04-14 17:41 Quote from: chrnobel on April 14, 2009, 02:37:52 pmYou could do something like this: Code: [Select]procedure TForm1.Button1Click(Sender: TObject); var   temptext:string; begin   temptext:=trimright(memo1.Text);   temptext:=temptext+edit1.Text;   memo1.Clear;   memo1.Text:=temptext; end; But why do you want the Memo to behave like this? /Christian I had to do something similar to that as a temp workaround, however it uses almost double the ram/processor. (A couple-hundred additions/removals a second.) Also, Why I want it to behave like that? One because thats how Delphi handles things and two, It makes for a much smaller footprint whilst running. ---------------------------------------------------------------------- chrnobel · 2009-04-14 19:16 Quote from: tehmwak on April 14, 2009, 07:41:16 pmI had to do something similar to that as a temp workaround, however it uses almost double the ram/processor. (A couple-hundred additions/removals a second.)To be quite honest, why in heavens name are you then using a visible component, when it is something that updates with 200Hz? QuoteAlso, Why I want it to behave like that? One because thats how Delphi handles things and two, It makes for a much smaller footprint whilst running. I can't remember how Delphi works in this situation, as I have always used TMemo in the way it is intended, meaning by using lines.add. Besides this, Lazarus is an open source project, entirely made by volunteers, and if you are going to attend actively in developing/improving it, it would be very welcomed. /Christian ---------------------------------------------------------------------- Marc · 2009-04-14 21:32 Quote from: tehmwak on April 14, 2009, 02:26:23 pmI thank you good sir. I must however take the time to point out that this whole trailing- new-line-business is making porting a plethora of delphi applications a pain in the arse. Who decided to add such a thing? Ask Borland, they decided to omplemnet this, this way. ---------------------------------------------------------------------- Martin_fr · 2009-04-14 23:15 Actually, I just tested with turbo delphi Memo1.Text = Memo1.Text + 'abc'; The first time (if you add to the text, the memo has from the resources) there is a new line. (You wont notice if memo is empty to start with) But if you keep doing it, there will be no additional new lines. ---------------------------------------------------------------------- Paul Ishenin · 2009-04-14 23:31 In 0.9.27 we already fixed that. Do you still have wrong output? If so then create a bug report.