Gentlemen,
I managed to trigger actions on close as follows by editing the close
Button, to add a current tiddler transclusion. To be honest there are other
ways to close and we may want a finish button that does this.
<$button message="tm-close-tiddler"
tooltip={{$:/language/Buttons/Close/Hint}}
aria-label={{$:/language/Buttons/Close/Caption}} class=<
<tv-config-toolbar-class>>>
{{!!onclose}}
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/close-button}}
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text"><$text
text={{$:/language/Buttons/Close/Caption}}/></span>
</$list>
</$button>
So as a test my test tiddler triggers a message
created: 20180403230925750
modified: 20180403232809754
onclose: <$action-sendmessage $message="tm-notify" $param=
"SampleNotification"/>
post: Bye
pre: Hi
tags:
title: Pre and Post tiddler
Also I modified $:/core/ui/ViewTemplate/body to include Pre and Post fields
as follows.
<$reveal tag="div" class="tc-tiddler-body" type="nomatch" state=<
<folded-state>> text="hide" retain="yes" animate="yes">
{{!!pre}}
<$list filter="[all[current]!has[plugin-type]!field:hide-body[yes]]">
<$transclude>
<$transclude tiddler="$:/language/MissingTiddler/Hint"/>
</$transclude>
</$list>
{{!!post}}
</$reveal>
This works except more needs to be done/understood to get the following to
work as an example
pre=<kbd>
Post=</kbd>
*So what remains?*
- Further testing of above examples for unforeseen consequences
- Learn how to use HTML or CSS to wrap "text" using fields within a
tiddler
- A Widget to trigger actions on render placed in View template to
include the content of a current tiddler field
I now see I could create a start button in tiddlers to trigger actions and
even provide a finish button (but it is nice to have this occur
automatically on open of a tiddler or close).
Regards
Tony
On Friday, March 30, 2018 at 12:56:51 PM UTC+11, TonyM wrote:
>
>
> Folks,
>
> This question may be from a place of ignorance, however can you tell me
> why it appears fields can only be set from inside a triggering process such
> as a button?
>
> No need to go into DOM trees and All that, I understand that at a high
> level.
>
> I was wondering if there is a reason I can NOT set a value in a tiddlers
> field using a macro, list, set or other method if only when a tiddler is
> rendered. without user intervention such as a checkbox, button etc...
>
> Or have I missed something?
>
> If it is as I suspect, could we not have a trigger that occurs as a
> tiddler is rendered, such that it may evaluate some conditions and assign a
> value to a field, before continuing to render the rest of the tiddler, now
> using the new field value?
>
> It would seem a little like StartupActions for a tiddler. However I have
> not worked through the amenity and practicality of this.
>
> I imagine one could cause multiple actions to occur on the opening of a
> given tiddler. Such that the opening a tiddler is a button that will launch
> some actions.
>
> Perhaps another way to think of it is a pre-processing step. I could
> imagine a block of wikitext could be evaluate (eg; Some variables
> determined and actions executed) before the rest of the wiki text is
> evaluated in a given tiddler) as a result this pre-processing will never be
> rendered only the result of its actions prior to rendering. Of course a
> timeout may be needed, set globally, overridden locally.
>
> Use cases?
>
> - Evaluate various values or determine if other values match various
> conditions before rendering
> - Allow tiddlers to respond to pre-conditions evaluated for them alone
> with simple flags
> - eg; If tiddler expiration date has past set status field = expired
> - Allow tiddlers to carry with them some logic and processing normally
> found in accompanying macros/plugins and user buttons. Increase
> share-ability.
> - Allow the generation of a log entry on opening a tiddler (I have
> being here), update a last read date.
> - Allow auto timing or start and end time logs (Would need a post
> process)
>
>
> I was taught not to raise a problem without suggesting a solution!
>
> Perhaps we could provide a way to specify a special kind of macro that is
> pre-processed without output (unless in error) eg:
>
> \defineaction onopen()
> <$list
> set field to result
> </$list
> \endaction
>
> In closing I suppose what I am suggesting is not only considering tiddlers
> as the atomic storage unit but also allow them to be the the process or
> function atomic unit.
>
> Regards
> Tony
>
--
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 [email protected].
To post to this group, send email to [email protected].
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/fc4ec7db-0777-4d02-8af5-0dca0a6fc576%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.