Tree / Explorer -- How to Generate Multiple State Tiddlers?

101 views
Skip to first unread message

@TiddlyTweeter

unread,
Feb 24, 2019, 11:52:04 AM2/24/19
to TiddlyWiki
This post is WAY too long. But I don't know how to shorten it and have it make sense. I try to get to the main issue in bold at the bottom.

I'm wanting tips about solving an issue concerning state tiddlers for the TREE macro (https://tiddlywiki.com/#%24%3A%2Fcore%2Fmacros%2Ftree)--the force behind "Explorer" in the "More" sidebar tab.

I had some discussion with @morosanune  on GitHub (https://github.com/Jermolene/TiddlyWiki5/issues/3792#issue-413380536), who played a part in its creation, who has a Version 2 of it that has proof of concept of using it with filtering: http://morosanuae.tiddlyspot.com/#Explorer%20tab%20v2.

I just find the Tree macro very good for understanding and using TW.

An issue is that whilst its easy to collapse all branches, expanding them currently has to be done one-by-one via click on "folder".

I think it would be great if you could expand a whole branch--with its sub-branches and leaves--on one click of a button.

FYI expanded branches are enabled by the Tree macro creating a state tiddler. On first click of a "folder" the branch state tiddler's content is 'show'. On second click the "folder" folds and the state tiddler's text field is changed to 'hide'.

I was trying to figure out how you could, via a button, create the state tiddlers needed for all the "sub-branches" of a "branch" and its "leaves" to be revealed in one go by creating a set of state tiddlers with text="show". 

Its beyond me as "branches" as such are virtual. They don't exist. The state tiddler to reveal "leaves" is the leaves' "path" less the final portion of the name after the last "/". Such "branch" state tiddlers, once set, function to reveal all "leaves" (real tiddlers) within that "branch". I have no idea how you'd code to automate the creation of the needed state tiddlers.

Here is an example on tiddlywiki.com ...

In the Explorer at https://tiddlywiki.com/#%24%3A%2Fcore%2Fui%2FMoreSideBar%2FExplorer navigate to $:/plugins/ and click all the sub-branches.

Then look at Advanced Search under filter ... [prefix[$:/state/tree/$:/plugins/]] to see the states created.

This branch contains 24 Tiddlers. And 8 branches need clicking/opening to reveal them all--i.e. 8 state tiddlers are created. 

How would I be able to create these 8 state tiddlers on one-click?

Any thoughts much appreciated!

Josiah

@TiddlyTweeter

unread,
Feb 24, 2019, 12:05:05 PM2/24/19
to TiddlyWiki
Repeat for email users...

TonyM

unread,
Feb 24, 2019, 4:46:47 PM2/24/19
to TiddlyWiki
Josiah,

I and I hope others will try and find a full solution however I believe conceptualy when you click to open a subtree the whole tree is rendered. That is the virtual tree is traversed once again.

A global state tiddler like you are asking for could have a single state tiddler. The branch at a time most likely has a qualify macro making a unique state tiddler for each tiddler in the tree.

One way to do this;
A batch change that changes all the state tiddlers below the current tiddler

I may return and progress this later today but thought I would provide a little to get it started.

Regards
Tony

@TiddlyTweeter

unread,
Feb 25, 2019, 8:11:31 AM2/25/19
to TiddlyWiki
Thanks TonyM

That was a very useful post! Thanks!

What I am thinking now is that rather than mass CREATE state tiddlers for Tree branches is to much more simply dynamically switch the "hide" or "show" of text fields globally in a branch for state tiddlers that ALREADY EXIST.

I will try write this up more clearly and come back if I can't do it.

Best wishes
Josiah
Reply all
Reply to author
Forward
0 new messages