This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/

RangeWidget Example

 7th March 2021 at 10:20am

Using Actions


The wikitext of this example is shown below:

\define getText() $(text)$ - value: $(value)$ - changed: $(actionValueHasChanged)$

\define range-log(text:"", value:"", tiddler:"$:/temp/range/log")
<$vars text="""$text$""" value="""$value$""" >
<$action-setfield $tiddler="""$tiddler$""" $index=<<now "0hh-0mm-0ss:0XXX">> $value=<<getText>>/>
</$vars>
\end

\define clear-range-log(tiddler:"$:/temp/range/log")
<$action-setfield $tiddler="""$tiddler$""" text="{}" show=show/>
\end

\define logTiddler()$:/temp/range/log

\define clearLogButton()<$button actions=<<clear-range-log>>>Clear Log</$button>

\define actionsStop()
<$macrocall $name="range-log" text="                    actionsStop" value=<<actionValue>> />
\end

\define actionsStart()
<$macrocall $name="range-log" text="                    actionsStart" value=<<actionValue>> />
\end

\define actions()
<$macrocall $name="range-log" text="actions" value=<<actionValue>> />
\end

!! Using Actions

<$range tiddler="$:/temp/range/1__" min="-1" max="10" default="1" increment="1"
  actionsStart=<<actionsStart>> actionsStop=<<actionsStop>> actions=<<actions>>/> {{$:/temp/range/1__}}

<$range tiddler="$:/temp/range/__2" min="0" max="1" default=".01" increment=".01"
  actionsStart=<<actionsStart>> actionsStop=<<actionsStop>> actions=<<actions>> /> {{$:/temp/range/__2}} 

<$checkbox tiddler=<<logTiddler>> field="show" checked="show" unchecked="hide"> Show log</$checkbox> <<clearLogButton>>

<$reveal stateTitle=<<logTiddler>> stateField="show" type="match" text="show">
<$transclude tiddler=<<logTiddler>> />
</$reveal>

---

The wikitext of this example is shown below:

<$codeblock code={{RangeWidget Example!!text}}/>