[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How many strings can a memo hold?

Posted on 2001-06-07
9
Medium Priority
?
198 Views
Last Modified: 2010-04-06
Hi All,

I have D4 and win2000NT. I want to store data (strings) in a memo. The strings are less 100
letters long and  always starting from the left. Some programmers put a limit on the number of
strings displayed this way before doing a delete to provide for  new incoming strings.
as in (snip)

   while Memo1.Lines.Count > 500 do
      Memo1.Lines.Delete(0);

But  in my case I need all of the strings that were sent from top to bottom once the delivery
 is completed and it could be substanilly more than 500.

Any suggestions for an efficient way to accomplish this? The number to lines can be greater
than the number shown above in the snip.

Delphi3
0
Comment
Question by:delphi3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 5

Expert Comment

by:Tom Knowlton
ID: 6164172
Perhaps you could store the string in a TStringList first, then display the strings in the TMemo as needed.

Tom
0
 
LVL 17

Expert Comment

by:geobul
ID: 6164251
Hi,
TMemo can hold up to 64K and there is no line number limit. You have to check Length(memo1.Lines.text)) and if it goes near 60K, delete some lines.

Regards, Geo
0
 
LVL 6

Expert Comment

by:edey
ID: 6164531
actually, just to clarify, there is an upper line count limit. 65536 char's divided by 2 chars (#10#13) gives you 32768 lines :)

Seriously, though, while the length of aTMemo is limited to a 16bit value, a TRichEdit has a 32bit limit (>4,000,000,000 chars).  While the helps says that the maxlength property can be set to 0 for large files, you actually need to set to a large value or it will be limited to 64k too.

GL
Mike
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 17

Expert Comment

by:geobul
ID: 6166797
Hi Mike,
Theoretically you are right but in reality you cannot add more than 10765 empty lines in a memo (tested on D3 and D5). Strange, isn't it?

Regards, Geo
0
 
LVL 6

Expert Comment

by:edey
ID: 6168335
Want to see something really strange? Try inserting lines of 0, 1, 2, 3 etc chars.  I tried inserting lines of spaces & got these results:

0 chars: 10756 lines
1 chars:  6951 lines
2 chars:  6981 lines
3 chars:  6519 lines
4 chars:  5359 lines

not eve a linear relationship.  Strange.

GL
Mike
0
 
LVL 17

Accepted Solution

by:
geobul earned 200 total points
ID: 6176477
So, what can I suggest you? Replace the TMemo component with a TRichEdit as Mike said above. To make the change easy to implement, delete the Memo, place TRichEdit and name it as your memo name was (Memo1 for example). Change Richedit properties WordWrap to false and ScrollBars to ssBoth.

I've just added 10 000 lines 100 chars each this way successfully (almost 1MB). If the number of lines is enough to you, you can use your code with 10 000 lines limit.

Regards, Geo
0
 
LVL 4

Author Comment

by:delphi3
ID: 6177537
Thanks, Geo,
I have tried a bunch of things in an attempt to work around the problem. I finally settled
on the combination of StringList and now adding TRichEdit replacing TMemo, it expands the upper limit
by a factor of 10.

while RichEdit1.Lines.Count > 5000 do
                      RichEdit1.Lines.Delete(0);

Actually I still do not know how to  incorporate these deleted lines into the string list, that is using  the richedit being read,
 but thankfully I'll not get to the 5000 limit so soon


Thanks again for your research  and help

Delphi3
0
 
LVL 6

Expert Comment

by:edey
ID: 6177560
Hmmm...

Well, I'm glad you got a solution. Cheers

GL
Mike
0
 
LVL 5

Expert Comment

by:Tom Knowlton
ID: 6177928
I don't see how to turn off notification for this question.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

649 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