 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Wayne & Carr Guest
|
Posted: Wed Jun 28, 2006 12:42 am Post subject: RichEdit Component - Unlimited Character Line |
|
|
Hello All;
Does anyone know of a RichEdit Component that will allow for over 10,000+
Character Strings?
I am not referring too [Lines] Added.
I am referring too [Character Strings].
As in:
A single line ---------:
somethingsomethingsomethingsomethingsomethingsomethingsomethingsomething
Just imagine that the line above can reach to and beyound 10,000 Characters.
This is what I am needing.
I have code (Supplied by: Russell Libby) That will get me past the default
Character Limit
But, it still stops are a certain number, even though it "acts" like it can
go further.
This code has helped me out a lot, but now, I am stuck with having to edit
[Delete] out 100's of lines. that are broken because of the "Character
String Limit"
So, what I am needing is a RichEdit component that will allow for almost
An "Unlimited" Amount of "Characters Per Line"
Thanks All;
Wayne |
|
| Back to top |
|
 |
Jerry Hayes Guest
|
Posted: Wed Jun 28, 2006 1:12 am Post subject: Re: RichEdit Component - Unlimited Character Line |
|
|
Wayne,
Could you possibly describe your business need? |
|
| Back to top |
|
 |
Wayne & Carr Guest
|
Posted: Wed Jun 28, 2006 2:50 am Post subject: Re: RichEdit Component - Unlimited Character Line |
|
|
Hello Jerry.
I thought that I made it very clear in the original message what I was
needing?
I need a RichEdit component (or) possibly source code that will allow me to
Send unlimited amounts of Data to a Single-Line.
We are dealing with "HUGE" Datafeeds from different companies.
We are then processing the Datafeeds, making them ready for insertion
Into a Database Table.
Some of the lines are very long. 7,000 - 15,000 Characters in Length.
And right now with the code that I have, it breaks after about 4,500
Character Strings.
This is what I have right now, it works good, but it still breaks after a
few thousand
Characters.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
RichEdit1: TRichEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
const
WB_CLASS_WHITESPACE = 0;
WB_CLASS_LINEBREAK = 1;
WB_CLASS_DELIMITER = 2;
WB_CLASS_NORMALCHAR = 3;
const
WB_CLASSIFY = 3;
WB_MOVEWORDLEFT = 4;
WB_MOVEWORDRIGHT = 5;
WB_LEFTBREAK = 6;
WB_RIGHTBREAK = 7;
const
WBF_CLASS = $0000000F;
WBF_ISWHITE = $00000010;
WBF_BREAKLINE = $00000020;
WBF_BREAKAFTER = $00000040;
const
WHITESPACE: Set of Char = [#9, #32];
DELIMITERS: Set of Char = ['"', '[', ']', '(', ')', ';', ',',
'.', '\', ''''];
LINEBREAKERS: Set of Char = [#10, #13];
function IsInDelimiterList(C: Char): Boolean;
begin
// Check for char in delimiter type list
result:=(C in LINEBREAKERS);
end;
function EditWordBreakProcEx(pchText: PChar; ichCurrent: Integer; cch:
Integer; Code: Integer): Integer; stdcall;
var i: Integer;
found: Boolean;
initial_pos: Integer;
begin
result:=0;
case Code of
WB_LEFT :
begin
while (not(IsInDelimiterList(pchText[ichCurrent])) and (ichCurrent >
0)) do Dec(ichCurrent);
if (ichCurrent > 0) then
result:=Succ(ichCurrent)
else
result:=-1;
end;
WB_RIGHT :
begin
while (not(IsInDelimiterList(pchText[ichCurrent])) and (ichCurrent <
cch)) do Inc(ichCurrent);
if (ichCurrent > 0) then
result:=ichCurrent
else
result:=-1;
end;
WB_ISDELIMITER :
begin
result:=1
end;
WB_CLASSIFY :
begin
if (pchText^ in WHITESPACE) then
result:=WBF_ISWHITE or WB_CLASS_WHITESPACE
else if (pchText^ in DELIMITERS) then
result:=WBF_BREAKAFTER or WB_CLASS_DELIMITER
else if (pchText^ in LINEBREAKERS) then
result:=WBF_BREAKLINE or WB_CLASS_DELIMITER
else
result:=WB_CLASS_NORMALCHAR;
end;
WB_MOVEWORDLEFT :
begin
Dec(ichCurrent);
found:=False;
while IsInDelimiterList(pchText[ichCurrent]) do Dec(ichCurrent);
while (ichCurrent < cch) and not(found) and (ichCurrent >= 0) do
begin
found:=IsInDelimiterList(pchText[ichCurrent]);
if (found and (ichCurrent >=0)) then
result:=Succ(ichCurrent)
else
begin
result:=MaxInt;
Dec(ichCurrent);
end;
end;
end;
WB_MOVEWORDRIGHT :
begin
if not(IsInDelimiterList(pchText[ichCurrent])) then
begin
while (not(IsInDelimiterList(pchText[ichCurrent])) and
(ichCurrent < cch)) do Inc(ichCurrent);
end;
while (IsInDelimiterList(pchText[ichCurrent]) and (ichCurrent <
cch)) do Inc(ichCurrent);
if (ichCurrent < cch) then
result:=Succ(ichCurrent)
else
result:=-1;
end;
WB_LEFTBREAK :
begin
while (not(IsInDelimiterList(pchText[ichCurrent])) and (ichCurrent >
0)) do Dec(ichCurrent);
if (ichCurrent > 0) then
result:=ichCurrent
else
result:=-1;
end;
WB_RIGHTBREAK :
begin
while (not(isInDelimiterList(pchText[ichCurrent])) and (ichCurrent <
cch)) do Inc(ichCurrent);
if (ichCurrent > 0) then
result:=ichCurrent
else
result:=-1;
end;
end;
end;
function RichEditGetLine(Handle: HWND; Index: Integer): string;
var Text: array [0..32768] of Char;
L: Integer;
begin
Word((@Text)^) := SizeOf(Text);
L := SendMessage(Handle, EM_GETLINE, Index, Longint(@Text));
if (Text[L - 2] = #13) and (Text[L - 1] = #10) then Dec(L, 2);
SetString(Result, Text, L);
end;
// Just add this button1 to RichEdit1.OnChange (or) OnEnter.
// Then load a file into it, that has long strings.
procedure TForm1.Button1Click(Sender: TObject);
var s: String;
begin
// Remove text limit from control
RichEdit1.Perform(EM_LIMITTEXT, 0, $7FFFFFFF);
// Set custom word break procedure
RichEdit1.Perform(EM_SETWORDBREAKPROC, 0, Integer(@EditWordBreakProcEx));
// Example of adding a really long line
RichEdit1.Lines.Add(StringOfChar('X', 16 * 1024));
// Get the first line, line 0. We can't use RichEdit.Lines[0] because the
internal
// buffer used is limited to 4KB.
s:=RichEditGetLine(RichEdit1.Handle, 0);
// Show line length
ShowMessage(IntToStr(Length(s)));
end;
end. |
|
| Back to top |
|
 |
Wayne & Carr Guest
|
Posted: Wed Jun 28, 2006 6:09 am Post subject: Re: RichEdit Component - Unlimited Character Line |
|
|
The component TAdvMemo, that I never thought would do what I needed.
Is working.
Unlimited Line Characters. (I added in a total of 30,000 characters in a
single line)
This component works great.
So I am going to stick with it for the time being.
Take Care All;
And thanks Jerry for your response to this issue.
Wayne |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed Jun 28, 2006 6:45 am Post subject: Re: RichEdit Component - Unlimited Character Line |
|
|
"Wayne & Carr" <noSpam (AT) spam (DOT) net> wrote in message
news:44a1a7aa$1 (AT) newsgroups (DOT) borland.com...
| Quote: | I need a RichEdit component (or) possibly source code that will
allow me to Send unlimited amounts of Data to a Single-Line.
We are dealing with "HUGE" Datafeeds from different companies.
We are then processing the Datafeeds, making them ready for
insertion Into a Database Table.
|
Why are you using a TRichEdit for that? It looks like you are using it just
to providing whitespace parsing of the data. Why not just parse the data
directly, and then send them to the Database directly afterwards? You are
not really gaining anything by using a TRichEdit for it.
| Quote: | function RichEditGetLine(Handle: HWND; Index: Integer): string;
var Text: array [0..32768] of Char;
|
That is a lot of data to put on the stack. You should be using the heap
instead for that much data.
Gambit |
|
| Back to top |
|
 |
Wayne & Carr Guest
|
Posted: Thu Jun 29, 2006 1:50 am Post subject: Re: RichEdit Component - Unlimited Character Line |
|
|
| Quote: | Why are you using a TRichEdit for that? It looks like you are using it
just
to providing whitespace parsing of the data. Why not just parse the data
directly, and then send them to the Database directly afterwards? You are
not really gaining anything by using a TRichEdit for it.
I understand what you are saying about using the RichEdit for what I am |
doing.
If you have some information (A link) that describes what you are talking
about
(A Delphi link preferably) Then I would love to see it.
| Quote: | function RichEditGetLine(Handle: HWND; Index: Integer): string;
var Text: array [0..32768] of Char;
That is a lot of data to put on the stack. You should be using the heap
instead for that much data.
Once again, I would like to see some information on this please. |
Wayne |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|