How to write a widget

71 views
Skip to first unread message

joearms

unread,
Dec 21, 2018, 4:07:12 AM12/21/18
to TiddlyWikiDev
Has anybody written a "How to write a widget" guide?

I'm looking for a guide that starts with the simplest possible
widget (zero args) and explains in gruesome detail exactly what
each line of code does.

Following this I'd like to see how arguments get added ..

Any suggestions?

Cheers
/Joe


Jeremy Ruston

unread,
Dec 21, 2018, 4:17:25 AM12/21/18
to tiddly...@googlegroups.com
Hi Joe

Chris Hunt did a nice walkthrough a few years ago:


Bonus - it’s made with v5.0.7, which now seems ancient. But not much has changed since then, so I’d expect the material to still work.

Alternatively, you could read through some of the core widgets in reverse order of complexity.


The “text" widget is a good place to start; it just renders a string of text provided as an attribute:


The “codeblock” is marginally more complex: it renders a <code>/<pre> pair to contain it’s rendered children:


The “vars” widget introduces variable assignments:


The “count” widget is a good example of a simple widget with a slightly more complicated refresh strategy: it only refreshes itself if the count has changed:


Finally, the “keyboard” widget is a simple example of a widget with an event handler:


Best wishes

Jeremy


--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/c4ac4aaa-18bb-4581-9e4a-2752bd5482bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

joearms

unread,
Dec 21, 2018, 6:46:44 AM12/21/18
to TiddlyWikiDev
Hi Jeremy - that's brilliant

Next problem is copyright

Here are some alternatives

     1) I contact the authors individually and ask if I can copy-paste-edit their tiddlers
         
         I get annoyed if people "borrow" my code without attribution so this is the least I can do

       This is OK if the authors are active and reply to emails but is very problematic if the material
       is really good, really old and the authors do not reply to emails and have not tagged their material
      with usage rights.

     2) I make a kind of "meta TW" ie construct
         a TW from a long list of Tiddlers (this is the old EDL idea from Xanadu) ((EDL = Edit description list))

     3) get an authors sub-group and give them access to a shared github account

         ...

It would be very nice if tiddlers had some kind of attribution field and if the TW as a whole
had permissions and reuse tiddler.

It would be nice if tiddlers that contained copy-paste data from external TWs had a
a "contributors" field which when clicked on said

    "This tiddler contains information obtained from the following sources"
     <tiddler> <date> <author>

Just as an aside my publisher (Pragmatic Press) requires written permission statements
from all authors who work I quote from - event Tweets (this follows legal action, where a Tweet
was reused without permission) - this is true of virtually all publishers, they worry that legal action will be
taken if they reproduce anything for which permission statements are not available.

(it's actually OK with emails - the problem is if you can't identify the author, or they don't reply to emails)

In order not to run foul of GDPR/copyright etc. I'd need explicit written permission
to quote from external tiddlers.

I don't really know how to solve this problem

Cheers

/Joe   
Reply all
Reply to author
Forward
0 new messages