Solved

Empty lines in memo

Posted on 2004-10-08
14
904 Views
Last Modified: 2012-05-05
Hi,

I have a problem with the memo component. When I add lines to it using memo1.lines.add('my line'); every new line has an empty line before it.

For example, if I do this:
memo1.lines.add('1');
memo1.lines.add('2');
memo1.lines.add('3');
I get this in the memo:
-----------------------------------
1                                            

2

3
-----------------------------------

What I want to know is how I can add those lines without having a space between them.
Any help is appreciated.

- MelchaS
0
Comment
Question by:MelchaS
  • 4
  • 3
  • 3
  • +4
14 Comments
 
LVL 6

Expert Comment

by:vadim_ti
ID: 12260317
in some place you add an empty line
otherwise you had to get
1
2
3
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12260408
procedure TFormMain.Button2Click(Sender: TObject);
begin
  Memo1.Clear;
  Memo1.lines.add('1');
  Memo1.lines.add('2');
  Memo1.lines.add('3');
end;

I got this in the memo:
-----------------------------------
1
2
3
-----------------------------------

but not what you describe .... Sorry
0
 
LVL 2

Expert Comment

by:-Karamja-
ID: 12260620
I also got the same as esoftbg,

What OS & Delphi version are you running?
Are you using custom style themes?
0
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 4

Expert Comment

by:tobjectpascal
ID: 12261044
i agree, something is adding the space..

what happens if you type in

Memo1.Text:='1'+#$0d+#$0a+'2'+#$0d+#$0a+'3';

do you still get the same problem?
0
 
LVL 7

Expert Comment

by:DavidBirch2dotCom
ID: 12261465
you've not managed to change the row height or the font size somewhere along the line have you ?

David
0
 

Author Comment

by:MelchaS
ID: 12261562
Sorry, I guess I wasnt specific enough.

The exact thing I do is this:

            Receive.Lines.Add('i:>->> ' + Send.Text);
            Receive.Lines.Add('o:<<-< Unknown command: ' + Send.Text);
            Send.Clear;

That adds the text in the Send memo to the Receive memo every time I press enter, and this is what I get if I do this a couple of times:

i:>->> fsdfds
o:<<-< Unknown command: fsdfds
i:>->>
gfdgfd
o:<<-< Unknown command:
gfdgfd

Somehow it adds everything on a new line...

I'm using Delphi 7 and WinXP, no custom themes...
0
 

Author Comment

by:MelchaS
ID: 12261576
This is if I do it more times:

i:>->> nvb
o:<<-< Unknown command: nvb
i:>->> hgvh

o:<<-< Unknown command: hgvh

i:>->>
gfdfd
o:<<-< Unknown command:
gfdfd
i:>->>
gdgfd
o:<<-< Unknown command:
gdgfd
i:>->> fsd'

o:<<-< Unknown command: fsd'

i:>->>
gdf
o:<<-< Unknown command:
gdf

What am I doing wrong?
0
 
LVL 2

Accepted Solution

by:
-Karamja- earned 50 total points
ID: 12261585
Sent.Text has a #13#10,

You will need to remove it,

Send.Text:= StringReplace(Send.Text, #13#10, '', [rfReplaceAll]);
0
 
LVL 7

Expert Comment

by:DavidBirch2dotCom
ID: 12261596
you could try *try*

replaceing any #13 's (returns) with nothing using something like

StringReplace(mystring, #13, '  ', [rfReplaceAll, rfIgnoreCase]);

David
0
 
LVL 7

Expert Comment

by:DavidBirch2dotCom
ID: 12261616
GRRRR I posted within in 60 seconds of you ! if this is the answer there should be a points split !

lol

David
0
 
LVL 2

Expert Comment

by:-Karamja-
ID: 12261622
Lol ;)
0
 

Author Comment

by:MelchaS
ID: 12262197
That works, thanks :)

Do you two agree on splitting the points, or should I give them to the first answer?
0
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12262924
that's a "quick" and dirty fix though...

do you have some code in the Memo events? like in the OnChange or something that would be adding those spaces?
0
 
LVL 7

Expert Comment

by:DavidBirch2dotCom
ID: 12267488
*sigh* it could so easily have been the other way around ;-p)
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question