Page 1 of 2
keep code tree folding state set by hand
Posted: 23.07.2024 05:43
by SamC
Hello,
When use codetree, there is an option "codetree fully unfold" . sometimes, I need to fold or unfold certain tree node by hand, and hope to keep the node folding state set by hand to aviod it be changed by the UI option(UI option can be taken as the initial folding state). Is it possible to make an option or API to do so?
Thanks!
Re: keep code tree folding state set by hand
Posted: 23.07.2024 07:29
by main Alexey
currently not possible - either you have all nodes unfolded (by option) or all folded, except that caret-position unfolds corresponding codetree node.
Re: keep code tree folding state set by hand
Posted: 23.07.2024 09:37
by SamC
The UI unfolds option is corresponding to which event?after folding certain node, by which event(on focus? on caret?) the node will be unfold again?
Re: keep code tree folding state set by hand
Posted: 23.07.2024 15:31
by main Alexey
for codetree API gives on_state, with IDs:
* APPSTATE_CODETREE_CLEAR: Code-Tree: content is cleared.
* APPSTATE_CODETREE_BEFORE_FILL: Code-Tree: before filling the content.
* APPSTATE_CODETREE_AFTER_FILL: Code-Tree: after filling the content.
* APPSTATE_CODETREE_SET_SELECTION: Code-Tree: caret position changed, then app sync'ed tree selection.
* APPSTATE_CODETREE_DBL_CLICK: Code-Tree: user made double-click in tree, then app sync'ed caret position with tree selection.
so try to read old codetree state in APPSTATE_CODETREE_AFTER_FILL, and on next filling - restore old folding of nodes.
or we need some new ID? maybe BEFORE_CLEAR is needed?
or maybe SET_SELECTION can help to detect new folded-state?
Re: keep code tree folding state set by hand
Posted: 24.07.2024 02:37
by SamC
I try to control the codetree folding state on different situation using the API. Before By default,on what event,the code tree will be filled again (the ui_tree_unfold will be called)?On open, on focus, on content changed,after certain seconds?

- S2024-07-24-10-34-59.png (8.47 KiB) Viewed 8817 times
Re: keep code tree folding state set by hand
Posted: 24.07.2024 08:26
by main Alexey
now API don't have event which is called on folding/unfolding of codetree node.
i will add it.
in the on_state i wil add APPSTATE_ ids.
does it help you?
Re: keep code tree folding state set by hand
Posted: 24.07.2024 09:31
by SamC
It helps, thanks!
However,maybe I didn't make myself clear on the previous post. I want to konw the updating frequency of codetree nodes by default. Such as after 5 seconds or after context changed?
Re: keep code tree folding state set by hand
Posted: 24.07.2024 10:39
by main Alexey
>updating frequency of codetree nodes by default.
option "ui_tree_time_fill" has usefull description
>>Delay after text change (in milliseconds), after which code-tree starts to fill.
default is 2000 msec.
so tree is updated after text editing + pause 2secs.
Re: keep code tree folding state set by hand
Posted: 24.07.2024 21:00
by main Alexey
tell me your About window info (press Copy btn there). so I can give the beta to test. it has added on_state flags for 'node was just folded/unfolded'.
Re: keep code tree folding state set by hand
Posted: 25.07.2024 00:18
by SamC
CudaText 1.214.6.6, win64-x86_64-win32, fpc 3.2.3
Thanks~