Closing tabs without opening a new one

50 views
Skip to first unread message

Matt Groth

unread,
Feb 27, 2017, 11:43:38 PM2/27/17
to TiddlyWikiDev
I would like to implement a function into my TiddlyWiki in which clicking on an already-opened tab closes it. I'm kind of stuck and was wondering if I could get some advice. Or if someone has already done this let me know. :)

As far as I understand, I need to send a message to $:/state/tab/sidebar (or whatever state) to delete its content if it matches the tab that was just clicked. The problem is I am having trouble figuring out where the code is that defines what actions are taken when the user clicks a tab.


Jeremy Ruston

unread,
Feb 28, 2017, 7:41:50 AM2/28/17
to tiddly...@googlegroups.com
Hi Matt

I would like to implement a function into my TiddlyWiki in which clicking on an already-opened tab closes it. I'm kind of stuck and was wondering if I could get some advice. Or if someone has already done this let me know. :)

It sounds like you’re getting into TiddlyWiki quite deeply now :)

As far as I understand, I need to send a message to $:/state/tab/sidebar (or whatever state) to delete its content if it matches the tab that was just clicked. The problem is I am having trouble figuring out where the code is that defines what actions are taken when the user clicks a tab.

Good stuff; your reasoning about the use of the state tiddler is correct. At the moment, clicking on a tab sets the state tiddler to the title of the tiddler holding the content of the tab. You’ll need to add a condition, clearing the state tiddler if it is already set to the current tab.

The core “tabs” macro is defined in this tiddler:


The tiddler appears blank in view mode; click the edit button to see the content.

Now, the change you want to make actually goes pretty deep; it touches the most fundamental part of the logic of the tabs macro: what happens when you click on a tab. Making the change requires understanding how the tabs macro currently works. I’m afraid I don’t have time right now to code it for you; if nobody else here steps up, you might have to figure it out yourself by studying the existing code.

Best wishes

Jeremy





--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/a0ab2f9b-26af-4846-a801-bf940a875142%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matt Groth

unread,
Feb 28, 2017, 5:49:36 PM2/28/17
to tiddly...@googlegroups.com
Hi Jeremy, 

I'm starting to use TiddlyWiki for many different purposes. I've found so many great resources, so I'm learning fast!

With your help, I accomplished my goal by implementing the reveal widget and made a pull request. :)

While I have you, could you take a look at my other question? I'm dying to understand how the local repository is implemented in my server.

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