Board index » cppbuilder » Finding the select start in TRichEdit
Nate Lockwood
![]() CBuilder Developer |
Nate Lockwood
![]() CBuilder Developer |
Finding the select start in TRichEdit2005-09-03 11:54:47 AM cppbuilder24 I'm using TRichEdit for the first time. I want to change the font (at least the color) of certain words if they start a line. My plan is to go through the TRichEdit a line at a time and test to see if the words start the line and if they do change the font. I think I see how to do this by selecting the text etc. but how do I get the start of the selected text? That is I know that one of the words starts this line RichEdit->Lines->Strings[i] so how do I get RichEdit->SelStart? TIA NATE |
Vladimir Stefanovic
![]() CBuilder Developer |
2005-09-03 03:24:43 PM
Re:Finding the select start in TRichEdit
Maybe something like this:
UNTESTED !!! int total_bytes = 0; for ( int i=0; i<RichEdit->Lines->Count; i++ ) { //if ( YOU DETECTED THAT Strings[i] MATCHES YOUR CRITERIA ) // USE SelStart = total_bytes WHICH NOW POINTS TO THE BEGINNING // OF THE Strings[i] int row_len = RichEdit->Lines->Strings[i].Length() + 2; // 2 is CR+LF total_bytes += row_len; } -- Best regards, Vladimir Stefanovic "Nate Lockwood" < XXXX@XXXXX.COM >wrote in message QuoteI'm using TRichEdit for the first time. I want to change the font (at |
Nate Lockwood
![]() CBuilder Developer |
2005-09-04 01:05:58 AM
Re:Finding the select start in TRichEdit
Vladimir Stefanovic wrote:
QuoteMaybe something like this: {smallsort} |