Can checkboxes use data dictionaries?

360 views
Skip to first unread message

Mark Armitage

unread,
May 29, 2016, 5:49:13 PM5/29/16
to TiddlyWiki
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.

Is this possible? 

I think I can do it with tags or fields but it is just a bit messy, I don't really want lots of fields or tags created. This way there would be one tiddler which could hold all the data and be referred to from any other one that I wanted to display the data on.

Hopefully I have explained it okay.

Thanks,

Mark.

Mark S.

unread,
May 30, 2016, 1:49:30 PM5/30/16
to TiddlyWiki
Since there's no $index field in the checkbox widget, I doubt it can be done.

But you can keep all your fields in one tiddler.

If your checkboxes were like this:

<$checkbox tiddler="CheckboxData" field="chk1" checked="open" unchecked="closed" default="closed">Field One</$checkbox><br/>
<$checkbox tiddler="CheckboxData" field="chk2" checked="open" unchecked="closed" default="closed">Field Two</$checkbox><br/>

then all the data would be stored in a single tiddler, CheckboxData.

Mark

Mark Armitage

unread,
May 30, 2016, 2:21:05 PM5/30/16
to tiddl...@googlegroups.com
Many thanks for that. It is an improvement but the fields are listed on every tiddler as user fields, I mean when you go to the field name popup. If you create a number of checkboxes then this is going to get very messy and unwieldy.

I was hoping that they had implemented data dictionary support for checkboxes as on:


That would be a much neater solution and keep the data nicely contained. Unfortunately it looks like that has been cancelled.

So I think my only options are: Lots of tags I don't want, or lots of fields I don't want, or don't use checkboxes, or hope someone makes a better solution via a plugin.

Ah well.

Jed Carty

unread,
May 30, 2016, 2:44:35 PM5/30/16
to TiddlyWiki
While it isn't ready yet I will extend the GenTags plug-in I made to support checkboxs.

Mark S.

unread,
May 30, 2016, 3:16:58 PM5/30/16
to TiddlyWiki
As a thought, you could do it with buttons and reveals. A small button like

[✓ ] Bowties are cool
[✓ ] Fezzes are cool

could be used to set your data fields. The button would swap/reveal itself as a checkmark or empty brackets depending on the state of the stored condition. (The documentation for RevealWidget seems to suggest that it can use data tiddlers). The code to make the boxes could be in macros so you would only need to write something like

<<fauxchex "bowties" "yes" "no">> Bowties are cool
<<fauxchex "fezzes" "yes" "no">> Fezzes are cool


Then when/if a plugin becomes available, you could just replace the macros with the plugin/widget.

HTH
Mark

Eric Shulman

unread,
May 30, 2016, 3:36:47 PM5/30/16
to TiddlyWiki
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



Mark Armitage

unread,
May 30, 2016, 4:38:42 PM5/30/16
to TiddlyWiki
Many thanks everyone, I will give this a go. 

Where do I find 'Inside TiddlyWiki' sounds like that might be useful. I remember TiddlyTools from my v2 days some years back! 

All the best everyone,

Mark.

Mark Armitage

unread,
May 30, 2016, 5:04:04 PM5/30/16
to tiddl...@googlegroups.com
Works like a charm, I am very grateful to you all.
In the image, the checkboxes are in the top tidder in a table, when clicked the data in the data dictionary held in the bottom tiddler is modified. All nice and tidy which suits my OCD. No spurious fields, no extra tags. Wonderful.

Mark Armitage

unread,
Jun 1, 2016, 4:48:54 AM6/1/16
to TiddlyWiki
I was asked about the sidebar, it's based on 'How to add a new tab to the sidebar' in the documentation.

I created a tiddler called 'Sidebar-Index' and tagged it with '$:/tags/SideBar', it then appears as a tab on the right, I wanted to change it's name so I added a caption field '~ToC', and a 'list-after' field with the value '$:/core/ui/SideBar/Open' makes sure it appears just after the Open tab. The tiddler is a 'text/vnd.tiddlywiki' type and contains: 

<$macrocall
 $name="toc-tabbed-external-nav"
 tag="Index" selectedTiddler="$:/temp/index/selectedTiddler"
 missingText="
<p>Missing tiddler.</p>"
/>
Now to add a horizontal tab into that area I just tag a tiddler with 'Index' and in it pops. This tiddler contains the following:

<<list-links "[tag[osx]sort[]]">>

Which basically means it is a list of all tiddlers with a given tag, in this case 'osx' and it sorts them.


Lastly, to put tiddlers into that horizontal tab I just tag them with that tag, so in this case 'osx'. 

It means I can have lots of sections within that tab and keep things nicely organized. 

Hope this helps.

Mark Armitage

unread,
Jun 1, 2016, 12:07:43 PM6/1/16
to TiddlyWiki
The only issue seems to be it doesn't select the new tabs at startup if you set it in the control panel!

Only just noticed this.

See 'auto open selected sidebar tab from a tiddler?' if it's important.


On Sunday, 29 May 2016 22:49:13 UTC+1, Mark Armitage wrote:

Jan

unread,
Jun 1, 2016, 6:12:57 PM6/1/16
to tiddl...@googlegroups.com
Hi Mark,
thanks a lot, i could not find a documentation of the toc-tabbed-external-nav macro before.
Your proof helped me a lot
All the best
Jan
--
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+...@googlegroups.com.
To post to this group, send email to tiddl...@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/09802e2e-92b9-4d13-a9ee-a0827cff8353%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stuart Amor

unread,
Jun 10, 2016, 2:54:24 AM6/10/16
to TiddlyWiki
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:
Reply all
Reply to author
Forward
0 new messages