This works well for me, but rather then entering a "0" when unchecked is it possible to remove the index and value from the data tiddler?
On Monday, 30 May 2016 20:36:47 UTC+1, Eric Shulman wrote: > 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 tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. 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/f6a98466-e805-4693-919c-55abd71d70a0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.