Board index » cppbuilder » Putting text in a Richedit

Putting text in a Richedit

I hope most of you can forgive my ignorance here. I have attempted to self
teach myself most of the ins and outs of C++ and it doesn't always sink in.
I'm hoping someone has an answer for me here. :)

Okay I have 2 Forms the user derives a value off of form 2 and has to send
it to form number 1 and put it in a richedit control. Here is the problem by
using: Richedit->Lines->Add(ValueFromOtherForm); I have to do a new line
That doesn't help me much. What I have on the other form is code to turn the
0x000000 codes you get for colors into hex so that you can use it for HTML
but I want to just insert the code in the RE Control where ever the cursor
is or in wherever text is selected. So it could be like this:

FONT COLOR=""
when the cursor is inbetween "" you click the value on the other form and
then what I want to do is have this as the aftermath:
FONT COLOR="#FFFFFF"
I have the code for making the html code I just don't know how to insert it
into the richedit control...

Thanks for any help you can provide,

Chris Webster
http://pylotech.hypermart.net/

 

Re:Putting text in a Richedit


Quote
> If I understand this, you want to know how to insert the hex value of
> the color code as text into the RE control, right?  If so, and if the
> cursor is between the quotes as you describe, you simply assign the
> string value of the code to the SelText property of the RE control.

> For example:

> int colorValue = 0x12345678;
> AnsiString hexStr = AnsiString::IntToHex(colorValue, 8);
> RichEdit1->SelText = hexStr;

> The above is untested, but should be close.

Exactly what I wanted... :) Thanks again Robert!

Chris Webster
http://pylotech.hypermart.net/

Other Threads