Triggering reveal widget with action widgets

@arunnbabu81 I have moved this new line of questions to a new thread.

To help keep topics on the forum readable and searchable for others that may have the same question in the future, please do not ask new questions in a topic marked as solved and start a new topic for each new line of questioning.

The closest two I can think of are:

  • $:/core/ui/KeyboardShortcuts/change-sidebar-layout
  • $:/core/ui/KeyboardShortcuts/toggle-sidebar

Based on the $:/core/ui/KeyboardShortcuts/toggle-sidebar , I tried this code

<$list filter="[[$:/state/SampleReveal2]is[missing]] [{$:/state/SampleReveal2}removeprefix[yes]]" emptyMessage=""" <$action-setfield $tiddler="$:/state/SampleReveal2" text="show"/> """>
<$action-setfield $tiddler="$:/state/SampleReveal2" text="show"/>
</$list>

With this, I was able to show the contents of the reveal widget using keyboard shortcut I set, if it was already in hidden state .

Then I created another tiddler with this code - which hides the text when its already revealed.

<$list filter="[[$:/state/SampleReveal2]is[missing]] [{$:/state/SampleReveal2}removeprefix[yes]]" emptyMessage=""" <$action-setfield $tiddler="$:/state/SampleReveal2" text="hide"/> """>
<$action-setfield $tiddler="$:/state/SampleReveal2" text="hide"/>
</$list>

I gave different shortcuts for both.

But only one shortcut will function at a time. I will have to delete one of them for the other one to work

Any suggestions?

Try a single shortcut with the following action widget:

<$action-setfield $tiddler="$:/state/SampleReveal2" text={{{ [{$:/state/SampleReveal2}match[hide]then[show]else[hide]] }}}/>

If the the logic isn’t quite what you want, try swapping the hide and show.

2 Likes

That works well. thank you @saqimtiaz

@saqimtiaz When I implemented this suggestion by @EricShulman to add a <<qualify>> macro to the reveal widget I used, the keyboard shortcut aren’t working.

This is the code I used.

Any suggestions ?

Anyone knows what’s going wrong here

Someone can please help?

@arunnbabu81 I think you would benifit from using some debugging techniques to break down your problem further. Place extra text in your output to show which parts are active. Perhaps use dumpvariables or varname=<<varname>> in places to see intermediate values. Use a freebstanding qualify macro to see the title. Keep in mind qualify is sencitive to the current tiddler variable.

We are all volenteers here and whilst we all like to help the more time consuming it is to even read the question the more you ask us to do.

It will help if you have a bundle of tiddlers that if dropped on tiddlywiki.com replicate your problem then we can see the real and comprehencive code. You may find as I do when preparing such an example 50% of the time I solve it myself.

You are asking an aweful lot of the community and often, which is good but if you could do more to learn including more debug techniques and to help us help you. We will be able to help you even more.

1 Like

I will put a Json file once I am back home.

I ask questions here in the forum when I am sure that I can’t solve it myself. Even though I have been using tiddlywiki for last 2 years, I am still in the beginner stage when it comes to code stuff. Not that I haven’t tried to read, it’s not easy to understand especially since I don’t have any programming knowledge. I am a working doctor and I do tiddlywiki things when I am free. I am actually proud of whatever I have done with my tiddlywiki (it’s really beautiful and functional) with my limited knowledge - mostly by asking here or in the GitHub (for the plug ins I use)

2 Likes

Hi @arunnbabu81 thanks for sharing the background. I’m not always fast enough to respond to your questions, but appreciate being able to see over your shoulder as you grapple with TiddlyWiki. The highest goal of the project is to let ordinary people exercise the kind of autonomous power that is usually the domain of experienced software developers.

2 Likes

@arunnbabu81 I understand your position. And your use of tiddlywiki is impressive. however I am making suggestions that should save you time, let us respond quicker and reduce your overall effort. I expect you could find parallels in your own field of medicine, however we often need to look at things differently when acting outside our established knowledge.

I have uploaded my test wiki into tiddlyhost.

https://arsheth.tiddlyhost.com/

I have included the relevant tiddlers in the homepage.

Press “Alt+z” to reveal and hide the sidetabs (seen on the right side of tiddler body). The problem is that all tiddlers with reveal button show and hide the sidetabs simultaneously when we click the reveal button or use the keyboard shortcut on any of the tiddler. To overcome this Eric suggested to use qualify macro here

But after using the qualify macro, the keyboard shortcut doesn’t work. That is my current problem.

1 Like

@arunnbabu81 I am trying to reverse engineer you wiki to see where this all happens. I must admit I am unfamiliar with the horizontal layout.

I observe this reverses the value found in $:/state/SampleReveal2

[{$:/state/SampleReveal2}match[hide]then[show]else[hide]]

Alt-Z toggles the content of $:/state/SampleReveal2

Since this uses a state tiddler of a fixed name it will always toggle everywhere this state tiddler is in use.

ALt-Z is a global shortcut so it seems hard to determine if it would respond differently if used when different tiddlers are active. ie if you used state-tiddler=<<qualify string>>

I am trying to find tiddler containing the button that is visible on tiddlers that toggles the sidebar inside tiddlers. I believe this is the one you want to be active only on the current tiddler? Buttons/Sidetabs?

I will keep looking

  • I can’t toggle off the preview in tiddlers.
braintemplate without pagecover by Mat

This tiddler is responsible for that button

I also noticed that. I saw it after including the editor also in the sidetabs. Didn’t investigate it further. Will have to find the cause after this issue is settled.

How would you choose which tiddler to open the reveal widget in?

Tiddlywiki needs to know it, but it doesn’ know with extra javascript/plugin for detecting with events in ViewTemplate, without button click. (I don’t know if the core of tiddlywiki has this functionality)

So if I have to you the keyboard shortcut, I will have to avoid using the qualify macro. Only problem is that all the tiddlers with reveal widget will get revealed when I use the shortcut. But it not a big problem since I will maximum have two tiddlers filling the screen space with my settings. So its a workable compromise.

If you look at this demo wiki - https://arsheth.tiddlyhost.com/

@Alvaro I have used some keyboard shortcuts based on BTC’s http://tiddlywiki-keyboard.tiddlyspot.com/

For example, if you use Alt+M shortcut , the focused tiddler will go into maximized state and vice versa. Can such a method be used to create a keyboard shortcut to open the reveal widget of the focused tiddler only .

image

This was my first question in any of the tiddlywiki community groups. Also this was my first interaction in any of the software community groups. Due to lack of prior experience, I tagged you while asking that question. But you were kind enough to reply me. Interestingly that was also your last comment in discord server.

Discord isn’t yet part of my regular online routine, but I’m happy to be tagged there, and always enjoy poking around when I do visit.