Solved

TMemo > 32k?

Posted on 1997-10-16
9
406 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
Technology Partners: 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

751 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