The Cycle macro

108 views
Skip to first unread message

Mohammad

unread,
Jul 19, 2019, 4:52:23 AM7/19/19
to tiddl...@googlegroups.com

The cycle macro gets an array (list) of items and creates a button to cycle through them. Clicking on the button, it selects the current item and stores it in the state tiddler. Clicking again cycle through the array and selects the next item. If all items are selected already, the cycle selects the first item again.

The state tiddler is used to store the selected item. By default the text field is used, but other fields can be used through the stateField parameter.


Published in Yazd!


--Mohammad 

 

cycle.pdf

Mohammad

unread,
Jul 19, 2019, 6:03:44 AM7/19/19
to TiddlyWiki
Good to know

What is the application of cycle macro?

One example is Todolist plugin. 5 colores are set as priority level and by clicking on a button you can cycle through colors to set the priority level.

--Mohammad

Watt

unread,
Jul 19, 2019, 6:39:34 AM7/19/19
to TiddlyWiki
Breaking News - "Todolist not done!"

Nice Mohammad, would you be able to cycle through days of the month with this? e.g. For a quick day view on a diary app?

Mohammad

unread,
Jul 19, 2019, 7:40:57 AM7/19/19
to TiddlyWiki
Hi Watt!


On Friday, July 19, 2019 at 3:09:34 PM UTC+4:30, Watt wrote:
Breaking News - "Todolist not done!"
I will publish a new version of Todolist soon! 
 

Nice Mohammad, would you be able to cycle through days of the month with this? e.g. For a quick day view on a diary app?

Yes, It can!

<<cycle arraySet:"Monday Tuesday Wednesday Thursday Friday Saturday Sunday" stateTiddler:"Test200" stateField:"text" btnCaption:"{{Test200}}" >>

It will use the day of week as button caption!

--Mohammad
 

Mohammad

unread,
Jul 19, 2019, 7:49:48 AM7/19/19
to TiddlyWiki
Watt,
 See example ii in

Cheers
Mohammad

On Friday, July 19, 2019 at 3:09:34 PM UTC+4:30, Watt wrote:

Watt

unread,
Jul 19, 2019, 10:03:50 AM7/19/19
to TiddlyWiki
Thanks very much Mohammad! It works very well. With the dates 01 to 31 typed into arraySet I can scroll through them and display events previously entered for that date into another data tiddler. A diary viewer!
I'm now experimenting to see if the arraySet can be transcluded in from either a field or from the values of another data tiddler.
Another small step for man, a giant leap for todolistists - thanks again.

HansWobbe

unread,
Jul 19, 2019, 10:17:02 AM7/19/19
to tiddl...@googlegroups.com
Mohammad:

This is very nice!  So far, i've been using Tobi's cycletags to move through a sequence of tags.  Your approach of using an array opens up several more use cases.

Thanks for sharing this (and your many other contributions).

Regards,
Hans

P/S.:

Doing a bit of a stealth edit just to see if its practical to set up a (shared) "Reference Thread".


<hr>

Watt

unread,
Jul 19, 2019, 1:22:14 PM7/19/19
to TiddlyWiki
My experiments failed, I can't get arraySet to accept a transcluded value. I was hoping to be able to pass the values to arraySet either from a field, a macro or possibly from the values of another data tiddler. No luck so far. I know it's not offered as an option but it seems like a useful tweak. It may be that I'm just not using the correct bracket incantation. Any suggestions welcome.

Mohammad

unread,
Jul 19, 2019, 3:13:30 PM7/19/19
to tiddl...@googlegroups.com
Thanks Hans!
 I got idea from your post. See my answer to Watt below!

Cheers
Mohammad

Mohammad

unread,
Jul 19, 2019, 3:18:24 PM7/19/19
to TiddlyWiki
Watt,
 It works, just note if you want to feed arraySet with transclusion use the $macrocall.

Example
Hans in his post pointed out how this can be used for Tagcycle. I use his idea as below

Assume you have A tiddler entitled Test300 as below

title: Test300
text
: 1 2 3 4 5 6 7 8 9 10


Now, assume you want to pass the Test300 text field as arraySet and use cycle to change its tags field

<$macrocall $name="cycle" arraySet={{Test300}} stateTiddler="Test300" stateField="tags" />

This will set the tags filed to 1, 2 , 3, ... each time you click on the button!

--Mohammad

Watt

unread,
Jul 19, 2019, 6:10:41 PM7/19/19
to TiddlyWiki
Great stuff! Thanks Mohammad and Hans. Another really useful component for the TW toolkit.
Reply all
Reply to author
Forward
0 new messages