Solved

TMemo > 32k?

Posted on 1997-10-16
9
400 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
Comment Utility
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
Comment Utility
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
Comment Utility
I'll try to send them to you.

0
 
LVL 3

Expert Comment

by:mirek071497
Comment Utility
If you receive this file then reject me if not then :

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


0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:AllenC
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now