Question

I am using C++ Builder to create a VCL forms application and am wanting a multiline editbox.

Am I correct in saying that I have to use a TRichEdit control to accomplish this?

If so, (and I have added one just to try out), how do I set the text in the control? There seems to be no .text or .caption property.

I can get the contents of the TRichEdit by the ->text property, but how do I 'set' the text?

Thanks

Was it helpful?

Solution

The Text property is read/write:

String s = RichEdit1->Text;

RichEdit1->Text = ...;

It is just declared as __published so you will not see it in the Object Inspector at design time. If you want to see the text at design time, you have to use the Lines property instead.

BTW, TRichEdit is not the only multi-line edit control. TMemo is another one. The main difference between them is that TRichEdit supports more formatting options than TMemo does. Think of them as the VCL equivalents of the MSWord and Notepad apps, respectively.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top