Eric,
Thanks so much for explaining this. I have long missed this point. It is
nice to know because one can possibly make use of this difference.
I wonder if this could be used to capture some values and restore them if
needed?
That make me think, why does the edit button not make a copy of the tiddler
so we can restore its previous value if needed?
That will be an easy button to make :)
Regards
Tony
On Thursday, August 6, 2020 at 12:38:40 PM UTC+10, Eric Shulman wrote:
>
> On Monday, August 3, 2020 at 6:34:07 AM UTC-7, Skeeve Magick wrote:
>>
>> Tiddler "ToDo" contains
>> <$list filter="[all[current]tagging[]]">
>> {{||$:/tagged/journal}} <$link /> (Letzter Eintrag: <$list
>> filter="[all[current]tagging[]!sort[created]limit[1]]" />)
>> <br />
>> </$list>
>> The Journal tiddler new title is defined to be "YYYY-0MM-0DD 0hh:0mm:0ss"
>> I opened this tiddler once in the morning. A few hours later I clicked
>> the edit-button and the new tiddler which opens has the timestamp of the
>> time I opened the ToDo tiddler. Not the current time.
>>
>
> Although you didn't show the contents of $:/tagged/journal, I assume it
> contains a $button that sends a "tm-new-tiddler" message to create a new
> journal tiddler.
>
> If this is the case, then I suspect the problem is due to a subtle yet
> important aspect of the $button definition.
>
> If you define a button using "inline" actions, like this:
> <$button>
> label
> <$action-sendmessage message="tm-new-tiddler" etc... />
> </$button>
> then the button's action(s) are *parsed when the button is rendered*.
> Thus, if the action(s) calculate the new title based on the current time
> (i.e., using the <<now>> macro), then that new title will use the time that
> the button is rendered.
>
> However, there is a different way to invoke a button's action(s), using
> the actions="""...""" parameter, like this:
> <$button actions="""<$action-sendmessage message="tm-new-tiddler" etc...
> />""">
> label
> </$button>
>
> or like this:
> \define myActions()
> <$action-sendmessage message="tm-new-tiddler" etc... />
> \end
>
> <$button actions=<<myActions>>
> label
> </$button>
>
> In this case, the button's actions are *parsed when the button is
> actually pressed*. Thus, any use of the <<now>> macro will correctly
> reflect the time when the button is pressed, not when it was rendered.
>
> Note that the TWCore's NewJournal button ($:/core/ui/Buttons/new-journal)
> uses the actions="..." method, while the NewJournalHere button
> ($:/core/ui/Buttons/new-journal-here) uses the "inline" actions method.
> Thus, NewJournal uses the correct "time of button press" timestamp, while
> the NewJournalHere button uses the incorrect "time of button rendering"
> timestamp.
>
> Hopefully, the above info will help you fix your button...
>
> Let me know how it goes.
>
> -e
>
>
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/08a68bdc-9ed5-4255-944f-e04443eff730o%40googlegroups.com.