Outlining and DisplayText

SyntaxEditor for Windows Forms Forum

Posted 17 years ago by Paul Fuller
Version: 4.0.0258
Avatar
I have outlining working based on a Statement class derived from AstNodeBase.

I would like the statement to display the first keyword that identifies its type when the node is collapsed.

So:
-Argle bargle;

Would show:
+Argle[...]

Instead of:
+[...]

Is this the intended purpose of DisplayText ?

Following the QuickStart example, I have added this to the Statement:

        public override string DisplayText
        {
            get
            {
                return "Test";
            }
        }

However nothing changes and indeed the getter is never called.

Previously I faked this by making the AST node start at the end of the first token. Now though I need the AST node to correctly reflect the whole statement. Also I would prefer the hover text to include the whole statement including the first keyword.

What am I missing ?

Comments (2)

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
The node's DisplayText is used in the TreeViews typically. For outlining node collapsed text, you can override your SyntaxLanguage.SetOutliningNodeCollapsedText method and return the appropriate text there. In fact you could probably access the related AST node via "node.ParseData" (cast it to the appropriate node type like Statement) and then return the value of the node's DisplayText property if you want.


Actipro Software Support

Posted 17 years ago by Paul Fuller
Avatar
Ok. I added property CollapsedText to my implementation of AstNode and use this in SetOutliningNodeCollapsedText().

Thanks for the answer.
The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.