Read Foldout?

Topics: Developer Forum
Apr 15, 2013 at 11:30 PM
Is there a way to read the foldout of a xml file that's loaded into Scintilla the way nodes can be read from a TreeView control hierarchy? Example Foldout Node.Nodes or Foldout Node.ParentNode, etc.

Apr 16, 2013 at 8:51 AM
I'm not one of the developers on this project, but as far as I'm aware, no, you can't. As far I know, neither the native Scintilla control nor ScintillaNET provide support for navigating a node tree that is present in your text. However, as an alternative, you could try creating an separate XML structure using the text, independently of the control. LINQ-to-XML may be an option for this, although LINQ has rather different syntax than typical Node syntax.
Apr 16, 2013 at 12:39 PM
Edited Apr 17, 2013 at 12:47 PM
There isn't a simple way, no, as ahouse is correct, there is no built-in way of navigating a node tree representing your text. You can however get the fold level of every line and create nodes based on that. A node would consist of a series of lines with the same fold depth. Any place where the fold level increases from the previous line would be the start of a child node. Be aware however that the fold depth representing 0 is actually 1024, and that the differences in fold level between 2 lines right next to each other may be more than 1.
Apr 17, 2013 at 2:36 AM
Thanks for the replies.

Blah the foldlevel worked and its not that difficult to implement.

Apr 17, 2013 at 8:55 PM
I know this wasn't my question, but I just wanted to thank blah anyway, since I'm using the fold level for this purpose in my project, I can't believe I didn't think of it myself.