On Sunday, May 29, 2016 at 2:49:13 PM UTC-7, Mark Armitage wrote:
>
> I would like to have a single tiddler which holds a data dictionary, say:
> TEST
>    AA:1
>    BB:0
>    CC:0
> Then in another tiddler, have a checkbox that gets it's value from the 
> data dictionary (TEST), so say:
> CB
>   [x] AA
>   [ ] BB
> I think that it should be something like {{TEST##AA}} and if the value is 
> 1 then check the box, otherwise uncheck it.
>

The $checkbox widget only supports toggle of tags or field values.  You 
can, however, achieve the effect you want, by creating a macro that uses 
$reveal, $button and $action-setfield (along with a little bit of HTML), 
like this:

\define toggleindex(tid,name,label)
<$reveal state="""$tid$##$name$""" type="nomatch" text="1">
   <$button class="tc-btn-invisible"> <input type="checkbox">$label$
      <$action-setfield $tiddler="""$tid$""" $index="""$name$""" $value="1"
/>
   </$button>
</$reveal>
<$reveal state="""$tid$##$name$""" type="match" text="1">
   <$button class="tc-btn-invisible"> <input type="checkbox" checked=
"checked">$label$
      <$action-setfield $tiddler="""$tid$""" $index="""$name$""" $value="0"
/>
   </$button>
</$reveal>
\end

Place the above in a tiddler (e.g., "$:/macros/tiddlytools/toggleindex"), 
and tag it with "$:/tags/Macro".

To use the macro, write something like:
<<toggleindex "SomeTiddler" "somename" "click here to toggle">>

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
InsideTiddlyWiki: The Missing Manuals



-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e9b770d1-1a45-4291-b88b-276d4f97d23d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to