Board index » delphi » HOW TO:Insert Text in an RichEdit Control.

HOW TO:Insert Text in an RichEdit Control.

I would like to insert to some text in an RichEdit Control with the
following code:
Editor.Lines.Add(
        Format(
            '//*************************************************//'+
        #13+'//* Created by    : %s                            *//'+
        #13+'//*************************************************//',
        [Edit1.Text]));

The problem is when I try to insert the username the size of the window
changes like this:
//*************************************************//
//* Created by    : Klaas Vaak                                       *//
//*************************************************//

And I should look like this :
//*************************************************//
//* Created by    : Klaas Vaak                    *//
//*************************************************//

I would also like to now how to insert the above standing text at the
begining of an Text file and at the end of the Text file,and insert the
text at the current position of the cursor.

I hope anyone can help me with this problem.

Sent via Deja.com http://www.deja.com/
Before you buy.

 

Re:HOW TO:Insert Text in an RichEdit Control.


I would like to insert to some text in an RichEdit Control with the
following code:
Editor.Lines.Add(
        Format(
            '//*************************************************//'+
        #13+'//* Created by    : %s                            *//'+
        #13+'//*************************************************//',
        [Edit1.Text]));

The problem is when I try to insert the username the size of the window
changes like this:
//*************************************************//
//* Created by    : Klaas Vaak                                       *//
//*************************************************//

And I should look like this :
//*************************************************//
//* Created by    : Klaas Vaak                    *//
//*************************************************//

I would also like to now how to insert the above standing text at the
begining of an Text file and at the end of the Text file,and insert the
text at the current position of the cursor.

I hope anyone can help me with this problem.

Sent via Deja.com http://www.deja.com/
Before you buy.

Re:HOW TO:Insert Text in an RichEdit Control.


Quote
<jdenek...@my-deja.com> wrote in message news:90oofg$tbe$1@nnrp1.deja.com...
> I would like to insert to some text in an RichEdit Control with the
> following code:
> Editor.Lines.Add(
>         Format(
>             '//*************************************************//'+
>         #13+'//* Created by    : %s                            *//'+
>         #13+'//*************************************************//',
>         [Edit1.Text]));

> The problem is when I try to insert the username the size of the window
> changes like this:
> //*************************************************//
> //* Created by    : Klaas Vaak                                       *//
> //*************************************************//

> And I should look like this :
> //*************************************************//
> //* Created by    : Klaas Vaak                    *//
> //*************************************************//

> I would also like to now how to insert the above standing text at the
> begining of an Text file and at the end of the Text file,and insert the
> text at the current position of the cursor.

You must use a fixed pitch font for the display and adjust the format call
as follows

    Format ('%s%*s', [edit1.Text, N - Length (edit1.Text), ' '])

where N is the amount of space allowed for a name.

Other Threads