Hi Mehdi,

while I would probably use javascript at this point, I did not even know
this is possible with widgets :)

Just a remark: I would not use a space character to distinguish states
in the reveal widget, better use type="nomatch" for the opposite. Also a
reveal widget creates a dom element, maybe better to use the list
element for if-else analogy in this case (yes, even though it is called
list widget it can be used for if else operations).

-Felix

On 18.06.2015 06:04, hobbyist writer wrote:
> Hi everyone.
>
> I would like to share with you some code. It consists of three
> interrelated Tiddlers that:
>
>  1. Store and display Geo-position.
>  2. Prompt the user for changes, if she/he decides to.
>  3. Fill some default value upon a change request, if the value is empty.
>
> Now this is simple to accomplish especially using JavaScript, BUT...
>
> I happened to notice that the <$reveal>
> <http://tiddlywiki.com/#RevealWidget> widget can be used to
> conditionally trigger ActionWidgets
> <http://tiddlywiki.com/#ActionWidgets>. Here are the contents of the
> Tiddlers. Note that we only need to
>
>   * transclude|*{{:/_template/geo-button}}* in any Tiddler as
>     interface, and
>     |
>   * |reference the Geo-position by *{{***|*$:/_template/geo!!_position}}*
>
> |
> tags:
> title:$:/_template/geo-button
>
>
> <$set name="thepos"value="51.5007, -0.1246">
> <$button>
> <$action-sendmessage $message="tm-modal"$param="$:/_template/geo-prompt"/>
> <$reveal type="match"state="$:/_template/geo!!_position"text="">
> <$action-setfield
> $tiddler="$:/_template/geo"$field="_position"$value=<<thepos>>/>
> </$reveal>
> <$reveal type="match"state="$:/_template/geo!!_position"text=" ">
> <$action-setfield
> $tiddler="$:/_template/geo"$field="_position"$value=<<thepos>>/>
> </$reveal>
> {{$:/_template/geo}}
> </$button>
> </$set>
> |
>
> |
> tags:
> title:$:/_template/geo-prompt
>
>
> !{{$:/_template/geo!!_caption}}
>
> <$edit-text
> tiddler="$:/_template/geo"field="_position"placeholder="51.5007,
> -0.1246"class="tc-edit-texteditor"focus="true"/>
> |
>
> |
> tags:
> title:$:/_template/geo
>
>
> <font size=3>''{{!!_caption}}''<font
> color=#BD1745>{{!!_position}}</font></font>
> |
>
>
> I look forward to learning from your feedback. I apologize if this is
> trivial or a mere repetition, but to me it was new and non-trivial.
>
>
>
> Best,
> Mehdi
> -- 
> 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]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/tiddlywiki.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/5e68c471-acbd-4a9c-9b28-a87a383920d4%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywiki/5e68c471-acbd-4a9c-9b28-a87a383920d4%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/BLU436-SMTP6841ED10CA6543F04B655ECEA50%40phx.gbl.
For more options, visit https://groups.google.com/d/optout.

Reply via email to