Solved

TMemo > 32k?

Posted on 1997-10-16
9
407 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
[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
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 50 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month4 days, 2 hours left to enroll

630 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