Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

TMemo and TStringList limits

Posted on 2001-08-24
6
Medium Priority
?
1,770 Views
Last Modified: 2012-08-14
I tried to load a HTML file into a TMemo and also into a TStringList.  The HTML file was 43kb.  When I loaded the fil into the TMemo, only about half the file was loaded and visible in the TMemo.  When I loaded the file into a TStringList via LoadFromFile() I again was missing a sizeable portion of the file.  When I analyzed the Capacity and Count properties after TStringList.LoadFromFile I had a Capacity of 288 and a Count of 200.  And yet approx. 30% of the file was missing from the StringList.

Can anyone explain why this happens?
0
Comment
Question by:Monroe406
6 Comments
 
LVL 5

Expert Comment

by:scrapdog
ID: 6424007
Did you write to the Capacity property at all?
0
 

Author Comment

by:Monroe406
ID: 6424029
>> Did you write to the Capacity property at all?

Nope.  Prior to the LoadFromFile the Capacity and Count were at 0.  After the LoadFromFile they were 288 and 200 respectively.
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 6424040
This is probably something that would be easier to diagnose if I were to do it myself.  If you want, mail the HTML file to scrapdog@jvlnet.com, and I'll have a look.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 27

Expert Comment

by:kretzschmar
ID: 6424466
per default depending on the os the limit is 32K,

you can extend the limit of the memo up to 64K
using the EX_LIMITTEXT Message before loading

for larger files use a TRichedit, there the limit is default set to 64K,
but can extended up to 2GB

a sample follows

meikl ;-)
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 200 total points
ID: 6424495
sorry i meant the message EM_EXLIMITTEXT

a sample with a trichedit

procedure TForm1.Button1Click(Sender: TObject);
begin
  Richedit1.Perform(EM_EXLIMITTEXT,0,$FFFFF);  //1 MB
  if Opendialog1.Execute then
    Richedit1.Lines.LoadFromFile(Opendialog1.FileName);
  RichEdit1.SelStart := Length(RichEdit1.Text);
  Richedit1.SetFocus;
end;

you must add the richedit-unit in the uses-clause
(there is this message-constant declared)

meikl
0
 
LVL 6

Expert Comment

by:edey
ID: 6425056
meikl beat me to it, so I'll have to sugest another alternative. Try this snippet in a project with a TWebBrowser, a TEdit & a TButton:

procedure TForm1.Button1Click(Sender: TObject);
var
   doc : variant;
begin
     webBrowser1.navigate(edit1.text);
     while webBrowser1.Busy do
           application.ProcessMessages;
     doc := webBrowser1.Document;
     doc.body.innerText := doc.body.innerHTML;
end;

GL
Mike
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Screencast - Getting to Know the Pipeline
Suggested Courses

885 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