Board index » cppbuilder » Auto Indent of TRichEdit

Auto Indent of TRichEdit

Hello there,

Can someone tell me how to make a TRichEdit component auto indent.  For
example, the the editing line is ( _ is the cursor position)

        abcd test _

After I have pressed Return Key, how can I make the cursor to:

        abcd test
        _

automatically and let user to type other characters.

Thanks.
Enoch.

 

Re:Auto Indent of TRichEdit


You need to set the paragraph indent to the value you want. This is the
correct way
See FirstIndent/LeftIndent

--
HTH Pete
GenHelp, the Component Writers Help authoring tool.
http://www.frasersoft.co.uk/genhelp

Quote
"enoch" <en...@memdb.com> wrote in message news:3b8c73e2_1@dnews...
> Hello there,

> Can someone tell me how to make a TRichEdit component auto indent.  For
> example, the the editing line is ( _ is the cursor position)

>         abcd test _

> After I have pressed Return Key, how can I make the cursor to:

>         abcd test
>         _

> automatically and let user to type other characters.

> Thanks.
> Enoch.

Re:Auto Indent of TRichEdit


Hello Pete,

I know these two fields in TRichEdit but I dont know how to make it work.
My question is, suppose I have some text in the TRichEdit and  _ is the
cursor:

            This is a test (Line 1)
                    This is a test (Line 2)_
        This is a test

After I press the Return key, I want a new line after the cursor and move
the cursor below the first character of the line, i.e.

            This is a test (Line 1)
                    This is a test (Line 2)
                    _
        This is a test

This is similar to the code editor in Borland C++.  I think I need to
implement the KeyDown event for TRichEdit component but I am not sure how to
make it work.

Thanks.

"Pete Fraser" <pete.dot.fraser.@.at.frasersoft.dot.co.uk> ???g??l
news:3b8ca5cb_2@dnews...

Quote
> You need to set the paragraph indent to the value you want. This is the
> correct way
> See FirstIndent/LeftIndent

> --
> HTH Pete
> GenHelp, the Component Writers Help authoring tool.
> http://www.frasersoft.co.uk/genhelp

> "enoch" <en...@memdb.com> wrote in message news:3b8c73e2_1@dnews...
> > Hello there,

> > Can someone tell me how to make a TRichEdit component auto indent.  For
> > example, the the editing line is ( _ is the cursor position)

> >         abcd test _

> > After I have pressed Return Key, how can I make the cursor to:

> >         abcd test
> >         _

> > automatically and let user to type other characters.

> > Thanks.
> > Enoch.

Re:Auto Indent of TRichEdit


You probably want to catch the KeyDown event and if it's a VK_RETURN, copy
any leading white space from the previous line (tabs/spaces) to this line.
Make sure that you don't allow windows to action the Keycode also or you
will get the white space inserted before the CR-LF (which you will have to
add yourself before white space added).

--
HTH Pete
GenHelp, the Component Writers Help authoring tool.
http://www.frasersoft.co.uk/genhelp

Quote
"enoch" <en...@memdb.com> wrote in message news:3b8cb6f2_2@dnews...
> Hello Pete,

> I know these two fields in TRichEdit but I dont know how to make it work.
> My question is, suppose I have some text in the TRichEdit and  _ is the
> cursor:

>             This is a test (Line 1)
>                     This is a test (Line 2)_
>         This is a test

> After I press the Return key, I want a new line after the cursor and move
> the cursor below the first character of the line, i.e.

>             This is a test (Line 1)
>                     This is a test (Line 2)
>                     _
>         This is a test

> This is similar to the code editor in Borland C++.  I think I need to
> implement the KeyDown event for TRichEdit component but I am not sure how
to
> make it work.

> Thanks.

> "Pete Fraser" <pete.dot.fraser.@.at.frasersoft.dot.co.uk> ???g??l
> news:3b8ca5cb_2@dnews...
> > You need to set the paragraph indent to the value you want. This is the
> > correct way
> > See FirstIndent/LeftIndent

> > --
> > HTH Pete
> > GenHelp, the Component Writers Help authoring tool.
> > http://www.frasersoft.co.uk/genhelp

> > "enoch" <en...@memdb.com> wrote in message news:3b8c73e2_1@dnews...
> > > Hello there,

> > > Can someone tell me how to make a TRichEdit component auto indent.
For
> > > example, the the editing line is ( _ is the cursor position)

> > >         abcd test _

> > > After I have pressed Return Key, how can I make the cursor to:

> > >         abcd test
> > >         _

> > > automatically and let user to type other characters.

> > > Thanks.
> > > Enoch.

Other Threads