[TW5] tabs macro

307 views
Skip to first unread message

Bob Flandard

unread,
Oct 14, 2015, 10:24:00 AM10/14/15
to TiddlyWiki
Hello,

Is this possible?

Use the tabs macro and have just two tabs. One tab transcludes a tiddler called "index" that contains a list of tiddler links and the second tab contains the tiddler from whichever link from the "index" tab was last clicked. Preferably when a link from the "index" tab is clicked the focus automatically switches to the second tab.

Thanks, Bob

Evolena

unread,
Oct 14, 2015, 1:03:06 PM10/14/15
to tiddl...@googlegroups.com
Hi Bob,

Have you tried the "toc-tabbed-internal-nav" from Table-of-Contents Macros? With your "index" tiddler being the only one tagged with the tag used for this toc, it may achieve something not too far from what you want?

Bob Flandard

unread,
Oct 14, 2015, 2:24:17 PM10/14/15
to TiddlyWiki
Hello Evolena,

Thank you for your suggestion. I did think about using the "toc-tabbed-internal-nav" macro, but my "index" tiddler of links is split into categories by field values, which would then required a unique tag for tiddlers in each category, removing the fun (and convenience) of just tagging them all "my tag" and then using your edit template method to choose the category (and other fields) from a drop-down select widget.

If it's possible (?) to add a tiddler tag automatically based on a field value, then I could modify the edit template to do that. So I tag a tiddler with "my tag" and somehow depending on the value I choose/define for the "category" field, it adds a tag named !!category. I think this would also require a tiddler of the same name as the category value to exist for the
"toc-tabbed-internal-nav" macro to work .

Another drawback of the
"toc-tabbed-internal-nav" macro is that in the "index" tiddler I was going to have a two column table with column1=link and column2=!!summary field. If this data was concatenated and used as a "caption" field the toc menu items would be too long.

What I really wanted was for each row of the "index" table to be a link itself and reveal the contents of the tiddler when clicked. To look a bit like Tobias Beer's Slidr macro for TWC http://tobibeer.tiddlyspace.com/#Slidr
but with the content of the tiddler being revealed. I really like the way the whole row is a link, rather than having a button; very pretty tb! can you do this for TW5?


All the best, Bob




Jed Carty

unread,
Oct 14, 2015, 4:08:52 PM10/14/15
to TiddlyWiki
You will have to create your own index macro thing, but yes it is possible.

Make one tiddler with this:

\define modTabs()
<<tabs "[[Select Tiddler]][[$(SelectedTab)$]]">>
\end

<$set name=SelectedTab value={{$:/state/Special Tabs Select State!!selected_tab}}>
<<modTabs>>
</$set>

and one called Select Tiddler with this:

<$select tiddler='$:/state/Special Tabs Select State' field=selected_tab>
<$list filter='[tag[HelloThere]]'>
<option><<currentTiddler>></option>
</$list>
</$select>

You would of course change whatever is in Select Tiddler to how you want to display your index, but anything that changes the field selected_tab in $:/state/Special Tabs Select State will update the tabs.

Bob Flandard

unread,
Oct 14, 2015, 5:07:38 PM10/14/15
to TiddlyWiki
Hello Jed,

Thanks very much for that, very nicely done.

I'll need to RTM to find which other widgets can modify fields of a given tiddler, because the select widget isn't quite what I want (it involves an extra mouse click).

Would it be a simple matter for the second tab to be switched to after a link from the "Select Tiddler" tab is clicked? (to save another mouse click).

All the best, Bob

Jed Carty

unread,
Oct 14, 2015, 5:21:21 PM10/14/15
to TiddlyWiki
Without knowing the specifics of what you are doing I would say use a button widget inside a list. Something like this:

<$list filter=<<somefilter>>>
<$button class='tc-btn-invisible'>__<$view field='title'/>__
<$action-setfield $tiddler='$:/state/Special Tabs Select State' $field=selected_tab $value=<<currentTiddler>>/>
</$button><br>
</$list>

where you replace <<somefilter>> with the filter to generate your list. It will make a list of the tiddler titles with each title underlined and when you click on the title it changes the other tab. If you know any css than you can probably style the buttons better than just underlined.

And to save you a bit of digging, the widgets that are generally used to change tiddler fields are:

checkbox
radio
button (with either action-setfield or the tiddler messages)
action-setfield
select
edit-text

Bob Flandard

unread,
Oct 14, 2015, 5:42:04 PM10/14/15
to TiddlyWiki
Thanks Jed,

That has saved me a lot of digging, I'll use it prospecting in them there hills (half's yours).

Happy doings, Bob

Matabele

unread,
Oct 14, 2015, 11:21:12 PM10/14/15
to tiddl...@googlegroups.com
Hi

The single page navigation method can be adapted to use with a substorylist.

Place this code into a 'Substory' tiddler:

<$navigator story="MySubStoryList!!list" history="MySubHistoryList">
<$list filter="[list[MySubStoryList!!list]]" history="MySubHistoryList">

! <$view field="title"/>
---

<$transclude mode="block"/>
</$list>
</$navigator>

And this code into an 'Index' tiddler:

<ul>
<$list filter="[tag[Concepts]]">
<li><$button set="MySubStoryList!!list" setTo=<<currentTiddler>> class="tc-btn-invisible">
<$view field="title"/>
</$button>
</li>
</$list>
</ul>

-- adapt the filter to select all tiddlers you wish to appear in your index
-- put the index tiddler into one tab, and the substory tiddler into the other tab

<<tabs "Index Substory" "Index" "$:/state/tab1">>

NB: Doesn't do the auto-focus switch

regards

Matabele

unread,
Oct 14, 2015, 11:39:07 PM10/14/15
to tiddl...@googlegroups.com
Hi

The drop down Index seems to be something like what I have done with my pop-over menu (on the RHS of the wiki) here.

regards

On Wednesday, 14 October 2015 16:24:00 UTC+2, Bob Flandard wrote:

Bob Flandard

unread,
Oct 15, 2015, 6:23:25 AM10/15/15
to TiddlyWiki
Hello Matabele,

Thank you very much for the code.

Interesting that functionally it look similar to Jed's solution, but uses different widgets. It'll take me a while to play with them both and try to understand what's going on.

All the best, Bob
Reply all
Reply to author
Forward
0 new messages