Triggering reveal widget with action widgets-new thread

This is a continuation of the linked discussion - Triggering reveal widget with action widgets

I am starting a new thread since it was not solved and there hasn’t been no discussion in the old thread for more than 6 months.

I have a custom viewtemplate to float what I call as sidetabs to the right of the tiddler body. It working well and I am happy with it. This is the template used.


<$let stateID={{{ [[$:/temp/abc/]addsuffix{!!title}addsuffix<qualify>] }}}>
   <$reveal type="nomatch" state=<<stateID>> text="show">
      <$button set=<<stateID>> setTo="show" class="mybutton" >
         {{$:/core/images/info-button}}
      </$button>
   </$reveal>
   <$reveal type="match" state=<<stateID>> text="show">
      <$button set=<<stateID>> setTo="hide" class="mybutton" >
         {{$:/core/images/info-button}}
      </$button>
<$list filter="[all[current]!is[system]!is[shadow]!tag[$:/tags/SideBar]!tag[Journal]!tag[$:/tags/ViewTemplate]!tag[$:/tags/Stylesheet]!tag[tweaks]!TheBrain[no]!has[page-cover]]">
<div class="rightside">

{{||Bottom Tabs for viewtemplate - without folding}}
</div>


<style>
[data-tiddler-title='{{!!title}}'] .tc-tiddler-body {
  border:1px solid transparent;
  width:50%;
}
[data-tiddler-title='{{!!title}}'] .rightside {
  border:1px solid transparent;
  width:50%;
  position: relative;
  float: right;
  right:0;
	}
</style>
</$list>
</$reveal>

<style>
.mybutton {float:right}
.mybutton {margin-top: -25px}
</style>

These are all tiddlers related to sidetabs - check the tag pill.

I am using a reveal widget to display this sidetabs. In the previous thread I had tried to create a keyboard shortcut to open and hide this reveal widget, but it was not succesful. I would like to solve this now.

These are the tiddlers related to the keyboard shortcut I tried - Check the tag pill

Below given is the code used for the keyboard shortcut.

<$let stateID={{{ [[$:/temp/abc/]addsuffix{!!title}addsuffix<qualify>] }}}>
<$action-setfield $tiddler=<<stateID>> text={{{ [<<stateID>>match[hide]then[show]else[hide]] }}}/>

Can some help to make it work.

Without looking at the details ;

Triggering reveal widget with action widgets

the normal approach as I understand is to;

  • Use a Trigger, such as a button, to set a state value
  • The reveal responds to that state

That is “triggers set a state” and the “reveal widget responds to a state”. It is subtly different but important.

How does tiddlywiki know which tiddler’s sidebar to toggle?

you could used the focused tiddler - shortcut would be:


<$let stateID={{{ [[$:/temp/abc/]addsuffix{$:/HistoryList!!current-tiddler}addsuffix[byside]] }}}>
<$action-setfield $tiddler=<<stateID>> text={{{ [<stateID>:text[hide]then[show]else[hide]] }}}/>

and in the first line of braintemplate without pagecover by Mat:

<$let stateID={{{ [[$:/temp/abc/]addsuffix{!!title}addsuffix[byside]] }}}>

This will act on the current selected tiddler

1 Like

Thank you so much @buggyj . Finally it’s working. I have updated the demo wiki with the new code. Sometimes when the sidetab is opened in a focused tiddler for the first time in a session I have to press the shortcut two times, otherwise everything works fine in my short testing. Will report if I encounter any issues

try it this way

<$let stateID={{{ [[$:/temp/abc/]addsuffix{$:/HistoryList!!current-tiddler}addsuffix[byside]] }}}>
<$action-setfield $tiddler=<<stateID>> text={{{ [<stateID>:text[show]then[hide]else[show]] }}}/>
1 Like

This is fixed with the new code. thanks @buggyj