Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
VCL
Standard Controls
TActionList
TButton
TCheckBox
TComboBox
TEdit
TGroupBox
TLabel
TListBox
TMainMenu
TMemo
TPanel
TPopupMenu
TRadioButton
TRadioGroup
TScrollBar
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/VCL/Standard Controls/TMemo
[ Add a report in this area ]
Report #:
89722
Status:
Closed
TMemoStrings.Insert() fails to insert blank strings at times.
Project:
Delphi
Build #:
6, 2010, XE
Version:
15.0
Submitted By:
Remy Lebeau (TeamB)
Report Type:
Basic functionality failure
Date Reported:
11/16/2010 7:09:09 PM
Severity:
Infrequently encountered problem
Last Updated:
3/20/2012 2:24:39 AM
Platform:
All platforms
Internal Tracking #:
281239
Resolution:
Fixed
(Resolution Comments)
Resolved in Build:
:
Duplicate of:
None
Voting and Rating
Overall Rating:
No Ratings Yet
0.00 out of 5
Total Votes:
None
Description
When using TMemo.Lines.Add() to insert blank strings, sometimes they are
ignored.
This has been reproduced in XE Update 1, D2010 Update 4/5, and even in
BCB 6 Update 4!
Steps to Reproduce:
Place a TMemo on a TForm and leave it empty. Name it 'Memo1'.
Add a TButton to the same form. Name it 'Button1'.
Add the following OnClick event handler to Button1:
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Lines.Add('2nd line');
Memo1.Lines.Add('');
Memo1.Lines.Add('4th line');
Memo1.Lines.Add('');
Memo1.Lines.Add('6th line');
end;
Start the program and enter *one* line of text into the memo, e.g. '1st line', *without* hitting return. Your cursor should thus still be somewhere in line 1 of the memo.
Click Button1
You'll find that the memo now holds these contents:
1st line (or whatever text you entered)
2nd line
4th line
6th line
As you can see, the first blank line added during runtime is omitted.
Workarounds
Added by Sysop
<<<<<<<<<
Please see Patch in [Attachments].
>>>>>>>>>
Attachment
MemoLinesError.zip
Comments
Tomohiro Takahashi at 11/17/2010 12:01:25 AM
-
Please try #13 instead of '' as below.
----
Memo1.Lines.Add('2nd line');
Memo1.Lines.Add(#13);
Memo1.Lines.Add('4th line');
Memo1.Lines.Add(#13);
Memo1.Lines.Add('6th line');
----
Remy Lebeau (TeamB) at 11/18/2010 6:21:42 PM
-
That does work, but it is a workaround, not a fix. Mark Edington came up with a patch that does fix the error. I have attached it.
Dick Boogaers at 11/19/2010 3:29:52 AM
-
Why don't you write down the patch in plain English.
Then everyone with any version of StdCtrls could have a look if it can be improved.
View Your Reports
Search
Server Response from: ETNACODE01
Developer Tools
Blackfish SQL
C++Builder
Delphi
FireMonkey
Prism
InterBase
JBuilder
J Optimizer
HTML5 Builder
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us