Copy to clipboard without crash

General TRichView support forum. Please post your questions here
Post Reply
christopher00
Posts: 2
Joined: Wed Jun 21, 2006 8:58 pm

Copy to clipboard without crash

Post by christopher00 »

Anyone know of a way to use the TRichViewEdit and copy data to the clipboard without the application crashing if the data in the TRichViewEdit is quite large? Windows Notepad can handle copying text within seconds after clicking Edit-Copy, or Ctrl+C, whereas if you have a large amount of data (i've tried just text) in the TRichViewEdit and do Ctrl+C (or use the Copy procedure), the application with the TRichViewEdit crashes.

Ideas?
Sergey Tkachenko
Site Admin
Posts: 17534
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Does it really crash? It just may take very long time.
It's because a standard TMemoryStream is used. TMemoryStream is unefficient when writing a large amount of data, because many memory reallocations occur.
In the next update, TRichView will use another stream class, with larger memory delta. Copying will be much faster.
shmp
Posts: 140
Joined: Sun Aug 28, 2005 10:19 am
Location: Sabah, Malaysia.
Contact:

Post by shmp »

Just to confirm. Have been using ctrl-c, ctrl-x and ctrl-v for a very long time and never faced a crash. It may have been very sloooooow because some other applications are running in the background or the file is just tooooo big. :D

Good luck.
Sergey Tkachenko
Site Admin
Posts: 17534
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Copying may be really very slow if document contains multimegabyte text.
In the current version, it can be improved only by modifying VCL source (changing MemoryDelta from Classes.pas to lager value (power of 2)). In the next update, this problem will be fixed without modifying VCL source.
Post Reply