Use a button to create a tiddler in view mode: Is this legal or illegal?

105 views
Skip to first unread message

Mohammad

unread,
Aug 5, 2018, 1:17:00 PM8/5/18
to tiddl...@googlegroups.com

Problem: 

I.  I want a button to create a tiddler put some text inside it and navigate to it in view mode NOT edit mode
II. If the tiddler is already exists, I want to navigate to tiddler and not create it again or create a new one with a numerical counter at the end (don't want to do what action create tiddler does)


So, I did like below:

\define _title() $(currentTiddler)$-thumbnails
\define _text() <<thumbnails $(currentTiddler)$>>

<$button set=<<_title>> setTo=<<_text>> >Thumbnails
<$action-navigate $to=<<_title>> />
</$button>



This button create a tiddler with the title of current tiddler with -thumbnails suffix and put this text <<thumbnails tidname>> inside it and then navigate to it!

Is this legal or illegal?

Actually I used ilegally from set/setTo parameters in button widget to create a new tiddler and if it exists use and navigate to it!



Mohammad

Ste Wilson

unread,
Aug 5, 2018, 1:28:32 PM8/5/18
to TiddlyWiki
The authorities will be around to investigate your illegal tiddling... :)

What do you mean?

Mohammad

unread,
Aug 5, 2018, 1:40:07 PM8/5/18
to TiddlyWiki
I mean from programming point of view! The good programming practice or standard always recommend clean and non error prone programming!
For example in Matlab or Fortran I use to program always we follow some rules!

So, here I mean standard (defacto) or good programming style!

I believe the elements shall be used for the purpose they were created! this help other understand code and can follow it and also it is easier to debug and mainatin


Mohammad

FrD

unread,
Aug 5, 2018, 1:40:34 PM8/5/18
to TiddlyWiki
Hi,

Seems fine to me ! Nothing to worry about -:)
The FBI (Fake Button Investigators) won't be alerted ...

Another way to do the same :

\define _title() $(currentTiddler)$-thumbnails
\define _text() <<thumbnails $(currentTiddler)$>>
\define actions()
<$action-setfield $tiddler=<<_title>> text=<<_text>>/>
<$action-navigate $to=<<_title>> /
>
\end

<$button actions=<<actions>>>Thumbnails2
</$button>



Regards

FrD

Mohammad

unread,
Aug 5, 2018, 1:45:20 PM8/5/18
to TiddlyWiki
Hello FrD,

 I like your solution! It uses widgets for the purpose they are designed (here you used the meaningful action-setfield and your code is much more clearer than what I wrote!
I use your code!

Thank you
Mohammad

PMario

unread,
Aug 6, 2018, 2:00:41 AM8/6/18
to TiddlyWiki
On Sunday, August 5, 2018 at 7:40:07 PM UTC+2, Mohammad wrote:
I mean from programming point of view! The good programming practice or standard always recommend clean and non error prone programming!
For example in Matlab or Fortran I use to program always we follow some rules!

So, here I mean standard (defacto) or good programming style!

There is no documented "best practice"  ... but TiddlyWiki UI itself is a "defacto" standard.

Jeremy is very strictly maintaining backwards-compatibility. So if you do things as they are done in the default UI, you should be save, that they will work in the future too.
 
I believe the elements shall be used for the purpose they were created! this help other understand code and can follow it and also it is easier to debug and mainatin

If you use "side-effects" (bugs) to do certain things, ... they may break in the future, if the bugs are fixed. ...

So imo it's better to report "buggy" behaviour, instead of using their side-effects :)

-m


Mohammad

unread,
Aug 6, 2018, 4:34:03 AM8/6/18
to TiddlyWiki
Many thanks Mario!

Best 

TonyM

unread,
Aug 6, 2018, 8:13:35 PM8/6/18
to TiddlyWiki
Thinking about conventions and methods. In the above examples whats with the <<_title>>?

Is this not going to confuse the use of <<__var__>> ?

Or do I not know this convention perhaps from JavaScript?

Tony
Reply all
Reply to author
Forward
0 new messages