mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-19 08:14:50 +00:00
55 lines
1.8 KiB
Plaintext
55 lines
1.8 KiB
Plaintext
|
created: 20201130191618831
|
||
|
modified: 20201130194441670
|
||
|
tags: RangeWidget
|
||
|
title: RangeWidget Example
|
||
|
type: text/vnd.tiddlywiki
|
||
|
|
||
|
\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>
|
||
|
|
||
|
---
|
||
|
|
||
|
<details>
|
||
|
<summary>Show the code [[RangeWidget Example]]</summary>
|
||
|
<pre><code><$view mode=text&><pre><code>
|
||
|
</details>
|