Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 06-14-2012, 02:12 PM
DbBanjo DbBanjo is offline
Member
 
Join Date: Jan 2005
Location: Maryland
Posts: 54
Default RichEdit: SelText & Text ...

Howdy,

I've inheritied an older app. which is using a 3rd party
replacement for RichEdit: TWPRichEdit (WPTools, ver 4.22a).
I'm attempting to add some new functionality which will
allow formatting based on selected (highlighted) text.

With the above in mind, I've noticed the following while
debugging:
1. When the entire contents of my richedit is selected,
the value of Text property is not equal to the value of
the SelText property.
2. Here is an example to show the diff.'s between the
Text & SelText property contents:
Memo.Text := 'TableName, '#$D#$A''
Memo.SelText := 'TableName, '#$D''

My questions: Where is the (above) #$A text coming from
in the Text propery and why isn't it also present within the
SelText property?

Thanks for any & all help,
Reply With Quote
  #2  
Old 06-20-2012, 03:20 PM
Ouiji Ouiji is offline
Senior Member
 
Join Date: Nov 2001
Location: US of A
Posts: 478
Send a message via AIM to Ouiji
Default

Just to clarify, so I am sure I am understand what you are asking.. If you enter
"Please excuse my dear aunt sally" [Without the quotes]
Into the rEdit/Memo, and you select all of it, and you execute something like:
Showmessage('|'Memo.Text + '/' + Memo.SelText + '|');

You would see a message box reading:
|Please excuse my dear aunt sally#$D#$A/Please excuse my dear aunt sally#$D|

Is that correct, or am I misunderstanding?
__________________
"not quite smart enough to be dumb"
Extended Stats No Longer Available Due To Changes To The Forum.
Reply With Quote
  #3  
Old 06-21-2012, 11:13 AM
DbBanjo DbBanjo is offline
Member
 
Join Date: Jan 2005
Location: Maryland
Posts: 54
Default

Howdy,

Thanks for the interest & post.

And yes, you are correct. In the logic I was writing
with this app, I wanted to determine if the "entire"
contents of a memo were highlighted. I found simply
attempting 'If (Memo.Text = Memo.SelText) Then' wasn't
working. My temp solution was to create a simple routine
to strip out any '#$D' & '#$A' char's from both Memo.Text and
Memo.SelText and then compare the two.

While the above allowed me to move on with my
little project, I still don't know where the extra '#$A'
char's were coming from. Since I'm really new to using
this TWPRichEdit comp, I'm guessing (and only guessing)
it might be some property setting within the TWPRichEdit comp ...

Thanks,
Reply With Quote
  #4  
Old 06-21-2012, 03:20 PM
Ouiji Ouiji is offline
Senior Member
 
Join Date: Nov 2001
Location: US of A
Posts: 478
Send a message via AIM to Ouiji
Default

I believe that you are correct, I am guessing that you found the post on StackOverflow containing a simple way to remove the line end / CRLF.


NumChars := Length(StringReplace(RichEdit1.Text, sLineBreak, '', [rfReplaceAll]));

I doubt this would be of any help, but I would be curious to know if the RichEdit.SelLength = Length(RichEdit.text), from what I am reading here it looks like it would return the same result with the extra line return characters. My best guess would be that the extra characters in the line end are to enable the component to contain images and other media and still function as an edit region.

Best Regards,
-ouiji

__________________
"not quite smart enough to be dumb"
Extended Stats No Longer Available Due To Changes To The Forum.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 11:53 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.