auto open selected sidebar tab from a tiddler?

183 views
Skip to first unread message

Mark Armitage

unread,
Jun 1, 2016, 12:06:17 PM6/1/16
to TiddlyWiki


My wiki opens a 'Stop Press' tiddler at the start for any notes I might want to leave myself. I also added some tabs to the sidebar (A-Z, ToC and Tasks). In the settings it has an option to pick which sidebar tab is opened when the wiki opens. Unfortunately if I select 'A-Z' in the drop-down then when I open my wiki it ignores it and stays on one of the core sidebars.

I have found one of Eric's bits about selecting a sidebar tab via code:

<$button> open "A-Z" tab
   <$action-setfield $tiddler="$:/state/tab/sidebar--1835078512" text="Sidebar-Index-AZ">
</$button>

and that works fine. But is there a way to automatically have the tab selected? I have a tiddler '<Stop Press>' that opens with the Wiki so I assume t could be done from there, just no idea how to do it. New to TW5 and haven'y used TW2 for many years, so very rusty.

TIA,

Mark

Birthe C

unread,
Jun 1, 2016, 1:01:49 PM6/1/16
to TiddlyWiki
Hi Mark,

Default tab is set in tiddler $:/config/DefaultSidebarTab


Birthe

Mark Armitage

unread,
Jun 1, 2016, 1:16:39 PM6/1/16
to TiddlyWiki
Okay. 

I'm not sure how that helps me? 

Birthe C

unread,
Jun 1, 2016, 1:34:23 PM6/1/16
to TiddlyWiki
Hi Mark,

Your own suggestion works, but you have to close the action set-field widget. You just forgot />


Birthe



Mark Armitage

unread,
Jun 1, 2016, 1:44:09 PM6/1/16
to TiddlyWiki
No that isn't it.

Maybe I didn't explain it properly.

I *CAN* create a tiddler with a button, using the code I posted which originated with Eric Shulman. That all works fine and selects the correct sidebar. Not sure what you mean about closing the action, the code is fine and works. If you mean that there is no </$action-setfield> then that is wrong, you don't need that when it is all in the opening definition, it's a shorthand. Again, it's Eric's code and it works.

I *CAN* set a *CORE* sidebar tiddler to auto-open when the wiki launches using the control panels popup. If I set it to auto-open one of my added tabs (Default sidebar tab in the control panel) then it does not work. Maybe it hasn't populated those tabs when this option is chosen and so it drops back to a core tab.

What I want is when I open my Wiki for the 'A-Z' sidebar tab to be selected. I can't see how to do that without some intervention. Yes I can press a button in my '<Stop Press>' tiddler and the tab appears, but then I could just as easily click on the tab myself instead so it saves no effort. I want the wiki to open, open my default tiddler *AND* select the 'A-Z' tab in the sidebar all on it's own.

Is this making sense?

RichardWilliamSmith

unread,
Jun 1, 2016, 9:12:40 PM6/1/16
to TiddlyWiki
Hi Mark,

This is not a feature I have previously tried to use and I concur that it appears to be broken.

The problem seems to be that the state-tiddler for the sidebar tabs is saved along with the wiki, which means it always opens with the same tab open as when saved. The behaviour is not limited to user-created tabs but also fails to work as expected for the core tabs.

If you delete the tiddler $:/state/tab/sidebar--1835078512 before saving the wiki, you should observe expected behaviour. I am *not* suggesting that as a working solution :) 

Presumably the offending tiddler can be excluded from the save process by modifying a filter somewhere, but for all I know, there may be a good reason for the current behaviour. Perhaps we should raise a ticket on github for this unless one of the devs replies here.

Regards,
Richard

Mark Armitage

unread,
Jun 2, 2016, 2:40:25 AM6/2/16
to TiddlyWiki
Ah okay. I didn't pay much attention to the core tiddler it opened, I just noticed it hadn't opened my A-Z tab and then fixated on that. I was thinking that it was selecting the tab before it had populated the new ones and so it just dropped back to a default. It's not  a massive pain but it is annoying. 

If it's a bug then hopefully it will get picked up and fixed. Do I need to do anything to raise it?

Thanks,

Mark.

PMario

unread,
Jun 2, 2016, 3:23:53 AM6/2/16
to tiddl...@googlegroups.com
On Thursday, June 2, 2016 at 8:40:25 AM UTC+2, Mark Armitage wrote:
Ah okay. I didn't pay much attention to the core tiddler it opened, I just noticed it hadn't opened my A-Z tab and then fixated on that. I was thinking that it was selecting the tab before it had populated the new ones and so it just dropped back to a default. It's not  a massive pain but it is annoying. 

If it's a bug then hopefully it will get picked up and fixed. Do I need to do anything to raise it?

Hi Mark,

The best place is github. see: https://github.com/Jermolene/TiddlyWiki5/issues

I did a short test, and it seems to be a bug. Some more investigation is needed.


-------- techy stuff for those who are interested

The TW widget, that's responsible to render the tabs is the <$reveal ..> widget, used within the <<tabs>> macro.
The reveal widget has a "default: Default value to use when the state tiddler is missing" parameter. ... but as you can see, it is only used, if the state tiddler doesn't exist.

...but... the tabs macro makes sure, that the state tiddler exists. ... ... There is some investigation needed, ... may be we need a new "force" parameter for the reveal widget.

------------

have fun!
mario


Jeremy Ruston

unread,
Jun 2, 2016, 3:51:12 AM6/2/16
to tiddl...@googlegroups.com
Hi Everyone

The issue here is possibly that the wording in control panel for the “default sidebar tab” setting is misleading. The default is only used as a fallback if the current tab state hasn’t been explicitly set (eg by switching tabs and saving the wiki). The setting was introduced as a clean way for tw5.com to have the “Contents” tab shown by default.

You can see how it is currently implemented here:


(Look for `default={{$:/config/DefaultSidebarTab}}` at the end of the marked line)

So I think your request here is for a change in behaviour to make the control panel setting override any current setting.

A useful way to achieve the change would be to introduce the proposed StartupOptions mechanism:


The core could then ship with a default startup option to set the initial sidebar tab.

Best wishes

Jeremy.


On 2 Jun 2016, at 08:23, PMario <pmar...@gmail.com> wrote:

On Thursday, June 2, 2016 at 8:40:25 AM UTC+2, Mark Armitage wrote:
Ah okay. I didn't pay much attention to the core tiddler it opened, I just noticed it hadn't opened my A-Z tab and then fixated on that. I was thinking that it was selecting the tab before it had populated the new ones and so it just dropped back to a default. It's not  a massive pain but it is annoying. 

If it's a bug then hopefully it will get picked up and fixed. Do I need to do anything to raise it?
The best place is github. see: https://github.com/Jermolene/TiddlyWiki5/issues

I did a short test, and it seems to be a bug. Some more investigation is needed.


-------- techy stuff for those who are interested

The TW widget, that's responsible to render the tabs is the <$reveal ..> widget, used within the <<tabs>> macro.
The reveal widget has a "default: Default value to use when the state tiddler is missing" parameter. ... but as you can see, it is only used, if the state tiddler doesn't exist.

...but... the tabs macro makes sure, that the state tiddler exists. ... ... There is some investigation needed, ... may be we need a new "force" parameter for the reveal widget.

------------

have fun!
mario



--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/09681330-68e2-4fee-9968-f5915f58ffa0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark Armitage

unread,
Jun 2, 2016, 4:21:50 AM6/2/16
to TiddlyWiki
Ah, I see. That isn't what I had thought it meant. I was under the impression that that would be the active tab when the wiki opened.

Personally I think that that is definitely needed. Surely the point is that you want to be able to force a specific state when the Wiki opens, that way anyone and everyone will get exactly the same starting position and reduces confusion. 

At least it should be an option, definitely the control panel needs a bit of a tweak in any case.

Do I need to do anything?

PMario

unread,
Jun 2, 2016, 3:46:15 PM6/2/16
to TiddlyWiki
On Thursday, June 2, 2016 at 9:51:12 AM UTC+2, Jeremy Ruston wrote:

So I think your request here is for a change in behaviour to make the control panel setting override any current setting.

A useful way to achieve the change would be to introduce the proposed StartupOptions mechanism:


The core could then ship with a default startup option to set the initial sidebar tab.

Jeremy thanks for your investigations! ...
The startup actions imo will be the better way to deal with a proper initial state, since it is more flexible than my initial thoughts.

-m

Reply all
Reply to author
Forward
0 new messages