Link to home
Create AccountLog in
Avatar of Orca
Orca

asked on

AutoIndents in RichEdit - Delphi 4.0

I'm creating an editor using a TRichEdit component in Delphi 4.0.  I want to emulate the AutoIndent feature from the Delphi code editor.  I've had no luck so far.  I've been able to read the number of blanks from the last line typed but haven't been able to do anything with that information.  Also, how to get the backspace key to go back incrementally through the indents?

Basically I don't think my approach is working so I'm looking for a ground up solution to this if possible.  Any help would be greatly appreciated.

Thanks in advance.
Avatar of TheNeil
TheNeil

Just a crazy top of my head idea but could you use tabs instead?

The Neil
Avatar of Orca

ASKER

That's one of the things I tried.  I pulled the number of blank spaces from the line previously typed and then tried to set the value of Tab[0] to the number of spaces multiplied by the width of either a space (which was something like 3 pixels) or a letter (such as 'w' which is like 8 pixels).  Since the tab stops have to be in pixels and not characters, that got me a value.  When I set that tab stop to that value, I could tab over, but it never lined up quite right with the line above it.  Granted, I could have been doing something wrong but it just didn't seem like the best way to go.  Which brings me to my original post.

Thanks though...
Why not skip back up to the line above, delete the spaces, and insert your new tab then? It'll all line up correctly

The Neil
ASKER CERTIFIED SOLUTION
Avatar of ZifNab
ZifNab

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Orca

ASKER

TheNeil: I'm not sure I follow what you're saying there...

ZifNab: I'll check out the components and let you know.  Thanks.
Avatar of Orca

ASKER

Zif,

Thanks for the link to those components.  They'll do everything I need and then some.  I should be able to tease out how they're doing it from their source.

I accepted your answer so you'll get the points.

Thanks.
Thanks Orca. Happy hunting to specific source code strips :-)

Zif.