Posted 20 years ago by billb - Software Craftsman, Yye Software
Avatar
Hello. Has anyone used the smart indent features recently? I searched the forums for previous posts and found one that looked like it was for an old version since the example didn't even compile.

I also didn't have any luck finding examples in the documentation or in the example program. Could someone provide a bit more insight? (I'm doing it for C# and VB.NET if that helps).

Thanks.

Comments (5)

Posted 20 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
The sample project has some code commented out for the event but you essentially just say how many tabs to indent in the e.IndentAmount property of the SmartIndent event arguments.


Actipro Software Support

Posted 20 years ago by billb - Software Craftsman, Yye Software
Avatar
I imagine that there is some way to determine what was typed on the previous line to figure out if I need to indent or not (yes, I'm showing my greeness here).
Posted 20 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I believe the SmartIndent only fires if the user presses Enter.

We would like to have more flexible auto-formatting support in the future and are open to all ideas anyone wants to post.


Actipro Software Support

Posted 20 years ago by billb - Software Craftsman, Yye Software
Avatar
Well for me at this point, the Enter is perfectly fine. What I was looking for is some sample code on how to determine when to indent.
Posted 20 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
We don't have any on hand, however what you'd do is probably get a TextStream (via Document.GetTextStream) for the current offset and then iterate backwords to see if there is a { (like for C#) that would cause an indent.

By default the IndentAmount will be set to whatever the tab indent of the previous line is.


Actipro Software Support

The latest build of this product (v24.1.1) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.