How to add a new line when #13
-
- Posts: 49
- Joined: Thu Jan 03, 2008 6:11 pm
- Location: South-Africa
How to add a new line when #13
Hi
I have a Database with memo fields which stores all my text. When a user requests a record I update TRichview from the DB (RichView.Add(Table.FieldByName('KeysCaptured').AsString,8);. Some of my text contains #13 characters. How can I add a blank line when TRichview encounters a #13.
Thank You
I have a Database with memo fields which stores all my text. When a user requests a record I update TRichview from the DB (RichView.Add(Table.FieldByName('KeysCaptured').AsString,8);. Some of my text contains #13 characters. How can I add a blank line when TRichview encounters a #13.
Thank You
-
- Site Admin
- Posts: 17530
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 49
- Joined: Thu Jan 03, 2008 6:11 pm
- Location: South-Africa
-
- Site Admin
- Posts: 17530
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Code: Select all
RichView.AddTextNL(Table.FieldByName('KeysCaptured').AsString, 0, 0, 0);
-
- Posts: 49
- Joined: Thu Jan 03, 2008 6:11 pm
- Location: South-Africa
Hi Sergey
I know that Addnl adds a new line but there is still a misunderstanding..
I allready have the text - the text is hard coded as follow:
This #13 is #13 a #13 test. When I load the text from my DB field, I load it in one go. The text is then displayed as "This #13 is #13 a #13 test" and not as:
This
is
a
test
I want to replace all the #13 characters with a blank line.. I hope that this better explain what I want.
I know that Addnl adds a new line but there is still a misunderstanding..
I allready have the text - the text is hard coded as follow:
This #13 is #13 a #13 test. When I load the text from my DB field, I load it in one go. The text is then displayed as "This #13 is #13 a #13 test" and not as:
This
is
a
test
I want to replace all the #13 characters with a blank line.. I hope that this better explain what I want.
-
- Site Admin
- Posts: 17530
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 49
- Joined: Thu Jan 03, 2008 6:11 pm
- Location: South-Africa
Hi Sergey
In my previous post I meant AddTextNL and not AddNL. In any case, this does not work.
If we do your suggestion:
1 TButton and 1 TRichview on a form. The OnClick event for the button is:
RichView1.AddTextNL('This #13 is #13 a #13 test',8,0,0);
RichView1.Format;
The result in the TRichview is:
This #13 is #13 a #13 test
AND NOT
This
is
a
test
In my previous post I meant AddTextNL and not AddNL. In any case, this does not work.
If we do your suggestion:
1 TButton and 1 TRichview on a form. The OnClick event for the button is:
RichView1.AddTextNL('This #13 is #13 a #13 test',8,0,0);
RichView1.Format;
The result in the TRichview is:
This #13 is #13 a #13 test
AND NOT
This
is
a
test
-
- Site Admin
- Posts: 17530
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
pawnflakes: Your text string is incorrect, it does not have line break characters. The correct test is 'This '#13' is '#13' a '#13' test'.
LS_M: InsertText supports #13#10 too. But it is used to insert text in the caret position as an editing operation, while AddTextNL is used to generate new document.
LS_M: InsertText supports #13#10 too. But it is used to insert text in the caret position as an editing operation, while AddTextNL is used to generate new document.
-
- Posts: 49
- Joined: Thu Jan 03, 2008 6:11 pm
- Location: South-Africa
Thanks Sergey and LS_M.
It works but it still doesn't solve my problem. I'm writing a keylogger application that captures all keys entered. When a user presses enter, a #13#10 code is added to the text. The text gets saved to a Database and then transferred to trichview on request. Is there no event for TRichview to replace all the #13#10 codes with a linebreak when the text gets loaded from the DB? I can't add the text line by line from the DB to trichview.
It works but it still doesn't solve my problem. I'm writing a keylogger application that captures all keys entered. When a user presses enter, a #13#10 code is added to the text. The text gets saved to a Database and then transferred to trichview on request. Is there no event for TRichview to replace all the #13#10 codes with a linebreak when the text gets loaded from the DB? I can't add the text line by line from the DB to trichview.
-
- Site Admin
- Posts: 17530
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 49
- Joined: Thu Jan 03, 2008 6:11 pm
- Location: South-Africa
Hi Sergey
When a user presses enter a #13#10 gets inserted. The problem is that the rest of the strings are not preceeded and ended with a colon. It seems that I will manually have to add colons.
All I wanted to know is whether it is possible to replace all the #13#10 charcters with the relevant linebreaks when I load the text to TRichview e.g.
an OnLoad event in TRichview that replaces any combination of characters with whatever I decide. It seems that it is not possible - don't worry, i will make another plan to solve this problem.
When a user presses enter a #13#10 gets inserted. The problem is that the rest of the strings are not preceeded and ended with a colon. It seems that I will manually have to add colons.
All I wanted to know is whether it is possible to replace all the #13#10 charcters with the relevant linebreaks when I load the text to TRichview e.g.
an OnLoad event in TRichview that replaces any combination of characters with whatever I decide. It seems that it is not possible - don't worry, i will make another plan to solve this problem.
-
- Site Admin
- Posts: 17530
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Of course it is possible to replace characters before adding to trichview, but if you really insert #13#10 characters, no replacing is needed, just call
Code: Select all
rv.Clear;
rv.AddTextNL(text_from_db, 0, 0, 0);
rv.Format;
-
- Site Admin
- Posts: 17530
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 49
- Joined: Thu Jan 03, 2008 6:11 pm
- Location: South-Africa
There is no need to send a sample application:
Let's assume we have a memo with the text: This #13#10 is #13#10 a #13#10 test //This is the text that I obtained from my keylogger - notice, the text is without colons because the keylogger doesn't know where to add colons..
Now, if I have a TRichView and button with an onClick event of the following:
rv.AddTextNL(memo1.text, 0, 0, 0);
rv.Format;
The text in TRichView is the same as in the memo without line breaks because there are no colons in the string. What I want to achieve is for TRichView to replace all #13#10 characters with a linebreak when i load the text from the memo to TRichview.
I hope you understand now what my problem is..
Let's assume we have a memo with the text: This #13#10 is #13#10 a #13#10 test //This is the text that I obtained from my keylogger - notice, the text is without colons because the keylogger doesn't know where to add colons..
Now, if I have a TRichView and button with an onClick event of the following:
rv.AddTextNL(memo1.text, 0, 0, 0);
rv.Format;
The text in TRichView is the same as in the memo without line breaks because there are no colons in the string. What I want to achieve is for TRichView to replace all #13#10 characters with a linebreak when i load the text from the memo to TRichview.
I hope you understand now what my problem is..