Get focused wrongly the search text box on the sidebar

24 views
Skip to first unread message

Mohammad

unread,
Jun 30, 2018, 11:58:06 AM6/30/18
to TiddlyWiki
A small code contains some macros were developed to show subtiddlers here


The code is given below

\define nextItem2(parent)
    <$set
    tiddler=<<currentTiddler>>
    field="currentTid"
    name=curIndex
    emptyValue={{{[tag[$parent$]first[]]}}}
    >
    <$set
    filter={{{[tag[$parent$]after{!!currentTid}]}}}
    name=NewIndex
    emptyValue=<<curIndex>>
    >
      <$action-setfield
      $tiddler={{!!title}}
      currentTid=<<NewIndex>>
      />
    </$set>
    </$set>
\end

\define previousItem2(parent)
    <$set
    filter={{{[tag[$parent$]before{!!currentTid}]}}}
    name=NewIndex
    emptyValue=""
    >
      <$action-setfield
      $tiddler={{!!title}}
      currentTid=<<NewIndex>>
      />
    </$set>
\end

\define steps2(TagName:"")
<$button actions=<<previousItem2 $TagName$>>>
{{$:/core/images/up-arrow}} 
</$button>
<$button actions=<<nextItem2 $TagName$>> >
{{$:/core/images/down-arrow}} 
</$button>

<$list filter='[tag[$TagName$]allbefore:include{!!currentTid}]' variable="myVar">
<h2><$text text=<<myVar>> /></h2>
<blockquote>
<$transclude tiddler=<<myVar>> mode="block"/>
</blockquote>
</$list>
\end


<<steps2 "png">>






The problem is when you click on the up/down button in this tiddler  and this tiddler is not the first tiddler in story river, it is scrolled to top (first tiddler in the story river) and also
the search text box on the sidebar gets focus!

What is wrong with this code?
You can give a try at 

BurningTreeC

unread,
Jun 30, 2018, 12:12:14 PM6/30/18
to TiddlyWiki
Hi Mohammad,

I think the reason for this behaviour is because you're calling the macro from the tiddler where it's defined, that way the buttons change the macro tiddler each time you click them, which causes the "importvariables" widget in $:/core/ui/PageTemplate to refresh, which causes a whole refresh of the page -> and that causes the behaviour you're experiencing

if you call your macro from ANOTHER tiddler, this should not happen

Mohammad

unread,
Jun 30, 2018, 1:05:50 PM6/30/18
to TiddlyWiki
Many thanks BTC,
 Yes I called the macro from another tiddler, I see the issue has gone!
Reply all
Reply to author
Forward
0 new messages