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

x
?
Solved

TMemo > 32k?

Posted on 1997-10-16
9
Medium Priority
?
409 Views
Last Modified: 2011-09-20
I'm currently using Delphi v1 for a compiler IDE. But, when ever I try to open a file biggers than 32k, I receive the error "Text greater than 32k". Is there a way to overcome the TMemo and/or Win 3.x edit control limit?

Thanks
http://tcp.home.ml.org/
0
Comment
Question by:AllenC
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1347806
Look at these components :

 http://carbohyd.ras.ru/torry/vcl/edits/jmpmemo.zip
  (can view text over 1MB, so it says)

 and offcourse there is also a shareware version :

 http://carbohyd.ras.ru/torry/vcl/edits/plusmemo.zip

Have fun,
c.u. ZifNab;
0
 

Author Comment

by:AllenC
ID: 1347807
I tried to access the server many times, but failed. (not even with a proxy server)

http://tcp.home.ml.org/
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1347808
I'll try to send them to you.

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 3

Expert Comment

by:mirek071497
ID: 1347809
If you receive this file then reject me if not then :

http://carbohyd.siobc.ras.ru/torry/vcl/edits/jmpmemo.zip


0
 

Author Comment

by:AllenC
ID: 1347810
I've tried the component, but it can only show and does not allow any inputs. (read-only)

Correct me if I'm wrong :)
0
 
LVL 1

Expert Comment

by:anilms
ID: 1347811
Assume that you have a form with a memo and two buttons. The first button is to open and load a file. The second button is to show more porttions of the file (32k at a time). {You can replace the second button with a proper PageDown handler function}. Use the blockread function to read a block of data -32k at a time, and then place it in the memo. When the user clicks the "ShowMore" button, the next 32k of data is shown. When you call the blockread function, the last parameter actually tells you how much has been read. If it is lesser than 32k, then add a null (0) at the end so that the memo component will not take data beyond that. Also note that we have defined c_data as an array of characters pointing exactly to the same address of the data array. This is a working example which we are using for files greater than 15 MB in size - but we have adapted it to different situations. You will have to fine tune it to your environment. In D3, we have derived a component out of TMemo to make it faster for huge files though it supports unlimited sizes. In D3 the component becomes very slow when you load a file more than 1MB in size.

var
  Form1: TForm1;
  data:array[1..32767] of byte;
  c_data:array[1..32767] of char absolute data;
  {c_data and data are both pointing to the same location}
  f:file; {File which is going to be loaded in the memo}
  i,max:integer;

implementation

{$R *.DFM}

procedure TForm1.ButtonShowMoreClick(Sender: TObject);
begin
     BlockRead(f,data,32767,max);
     if max<32767 then data[max+1] := 0;
     Memo.Text := c_data;
end;

procedure TForm1.ButtonLoadClick(Sender: TObject);
begin
     AssignFile(f,'test');
     Reset(f,1);
     ButtonShowMoreClick(Self); {To load the first 32 k}
end;

0
 

Author Comment

by:AllenC
ID: 1347812
It looks an alternative to me, but the point is, my program is an IDE for FPK-Pascal. If I put down the "show more" button, it'll make the program very difficult to use and requires lots of changes to the program code itself.
0
 
LVL 1

Expert Comment

by:anilms
ID: 1347813
Of course, you should not put a "Show More" button, you should attach it to the ScrollBar and KeyPress event of the Memo - check whether you are at the end of the memo and then load the next section. As I said earlier, this is the way we are forced to handle very huge files, loading the whole file takes too much time on NT though the TMemo component in D3 supports very huge files.
0
 
LVL 3

Accepted Solution

by:
altena earned 100 total points
ID: 1347814
The windows edit control cannot contain more than 32K text
(as you found out)

The solution is to load the entire text in memory and make
the edit control display one "page"

Whenever the user scrolls off the page, you copy another
page of text in the edit control.

(Sorry, No free source for this one.)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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…
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…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

926 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