$linkcatcher widget, need an example

65 views
Skip to first unread message

Mohammad

unread,
Feb 21, 2020, 2:03:58 AM2/21/20
to TiddlyWiki
I am using $link to create some links using $list widget!

I want to save the title of clicked item in a temporary tiddler for further processing. We know the $link widget does not supports actions

How can I do this?


<$link to=<<currentTiddler>>><$text text=<<currentTiddler>>/></$link>
<$linkcatcher actions="""<$action-setfield $tiddler=<
<tidSelectedItem>> text=<<currentTiddler>> />""" />


here the tidSelectedItem is a variable refers to my temporary tiddler to keep the title of clicked item


Mohammad

Mohammad

unread,
Feb 21, 2020, 2:32:05 AM2/21/20
to TiddlyWiki
I found the solution

It seems the $linkcatcher  catch the link action so, if one needs to navigate shall pass a message to $linkcatcher
The logic is a bit confusing

Example
  • link and navigate to clicked title
  • capture the title of clicked item and store in my tiddler given through a variable

<$linkcatcher set=<<tidSelectedItem>> setTo=<<__item__>> message="tm-navigate">
<$link to=<<__item__>> overrideClass=<<openItemClass>> >
 
<$view tiddler=<<__item__>> field="caption">
   
<$view tiddler=<<__item__>> field="title"></$view>
 
</$view>
</$link>        
</$linkcatcher>

Remarks
  • a link to item is created (item holds a title is given through macro input parameter
  • a proper form of caption/title is shown using $view widget
  • on click linkcatcher use the tm-navigate to navigate to tiddler its title is given by item
  • the title of clicked item is stored in a temporary tiddler (tidSelectedItem holds the title of temporary tiddler)

--Mohammad

TonyM

unread,
Feb 21, 2020, 3:09:15 AM2/21/20
to TiddlyWiki
Thanks for sharing the result Mohammad. I wanted to work on this as well.

Tony

Eric Shulman

unread,
Feb 21, 2020, 3:12:23 AM2/21/20
to TiddlyWiki
On Thursday, February 20, 2020 at 11:03:58 PM UTC-8, Mohammad wrote:
I am using $link to create some links using $list widget!
I want to save the title of clicked item in a temporary tiddler for further processing. We know the $link widget does not supports actions
How can I do this?

How about using a $button instead of the $link widget?  Something like this:

\define showlink(item)
<$tiddler tiddler=<<__item__>>>
   
<$button class="tc-btn-invisible">
     
<$view field="caption"><$view field="title"/></$view>

     
<$action-setfield $tiddler=<<tidSelectedItem>> text=<<currentTiddler>>
/>
      <$action-navigate /
>
   
</$button>
</
$tiddler>
\end

Note: I used the <$tiddler> widget to set the <<currentTiddler>> to the <<__item__>>.  This is just so the $view and $action-navigate widgets can use their default parameters for $tiddler and $to

-e

Mohammad Rahmani

unread,
Feb 21, 2020, 3:13:34 AM2/21/20
to tiddl...@googlegroups.com
Tony,
 I will post some examples and will need your review. I found it confusing and worth to prepare some examples!
I hope other also share their thoughts.


Best wishes
Mohammad


On Fri, Feb 21, 2020 at 11:39 AM TonyM <anthony...@gmail.com> wrote:
Thanks for sharing the result Mohammad. I wanted to work on this as well.

Tony

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/e94832e3-8dcf-42df-be1d-88aab8b82179%40googlegroups.com.

Mohammad Rahmani

unread,
Feb 21, 2020, 3:20:37 AM2/21/20
to tiddl...@googlegroups.com
Many thanks Eric. This is a great solution.

In my opinion, the $button here is more clear and semantic and for me is quite understandable.
The issue I have is I cannot drag the link like what I see in Open or Recent tabs in the sidebar and I need to have that feature.

What do you think?


Best wishes
Mohammad

Eric Shulman

unread,
Feb 21, 2020, 4:07:10 AM2/21/20
to TiddlyWiki
On Friday, February 21, 2020 at 12:20:37 AM UTC-8, Mohammad wrote:
Many thanks Eric. This is a great solution.

In my opinion, the $button here is more clear and semantic and for me is quite understandable.
The issue I have is I cannot drag the link like what I see in Open or Recent tabs in the sidebar and I need to have that feature.

The $button widget has an optional "dragTiddler" parameter for enabling dragging.  For this use case:
 <$button class="tc-btn-invisible" dragTiddler=<<currentTiddler>>>

-e 

Mohammad

unread,
Feb 21, 2020, 4:31:12 AM2/21/20
to TiddlyWiki
Yep,
 Thank you Eric!

--Mohammad
Reply all
Reply to author
Forward
0 new messages