Trigger action when a tab loses focus?

31 views
Skip to first unread message

Tony K

unread,
May 23, 2020, 9:08:59 AM5/23/20
to TiddlyWiki
is there a way to trigger an action when a tab loses focus?

I know that the state tiddler changes but how can I "watch" the state tiddler and issue a command when its content changes?

thanks

Mat

unread,
May 23, 2020, 9:37:04 AM5/23/20
to TiddlyWiki
Is it a limited set of actions that makes the tab lose focus, perhaps "clicking on another tab" or is it just anything that makes it lose focus? Because the tab state tiddler doesn't change unless you click on another tab.

<:-)

Tony K

unread,
May 23, 2020, 9:39:09 AM5/23/20
to TiddlyWiki
Hello Mat,

yes clickling on another tab wld do, I just don't want to go to every other tab (it is in the sidebar) and edit the code 

Mat

unread,
May 23, 2020, 10:07:54 AM5/23/20
to TiddlyWiki
OK, one approach would be to modify the core macro for buttons or to create your own, i.e the tiddler $:/core/macros/tabs

As you'll see there, the tabs are really buttons, just styled as tabs. Buttons are, as you know, simple to make trigger actions.


The previous is if you need to trigger actions. But things can be "affected" by merely reading the state tiddler:

<$list filter="[[STATETIDDER]search[XXX]]">
show this
</$list>

<:-)

Saq Imtiaz

unread,
May 23, 2020, 10:16:23 AM5/23/20
to TiddlyWiki
I wrote a widget at some point that allowed you to setup actions to be triggered in response to specific tiddlers changing. The issue from what I recall, was the potential to trigger recursion.

Tony K

unread,
May 23, 2020, 10:20:35 AM5/23/20
to TiddlyWiki
however can i edit a tiddler field without a "Trigger" from what I have noticed it is an $action-setfield and it needs a button to be clicked or something no?

Mat

unread,
May 23, 2020, 10:29:50 AM5/23/20
to TiddlyWiki
Tony K wrote:
however can i edit a tiddler field without a "Trigger" from what I have noticed it is an $action-setfield and it needs a button to be clicked or something no?

Right, to have it edited it needs an action trigger. 

BUT I just note in the docs that there's a  buttonTemplate attribute! I've never used it but I would assume this means you can crate your own custom buttons that the macro then uses. Do report here if you try it out.

<:-)
Reply all
Reply to author
Forward
0 new messages