I think anything evaluated within List needs to be "real" That is, the 
emptyMessage doesn't work the same as if you got real results. I'm sure 
someone will correct me on this if I'm wrong.

What I did was to 

*(1) Change the filter so that something always gets iterated, *
*(2) enclose the button invocation inside list instead of set and use the 
variable feature to specify a "mytag" as the output, *
*(3) Create a macro to wrap mytag in brackets*
*(4) Use the wrapper with the tags attribute*

Maybe other stuff. It seems to work, assuming that your use case was that 
you wanted to invoke the button from preview mode and/or from the closed 
tiddler. I'm not sure if you even need the macros at this point other than 
the new wrapper macro. You can check that out if you want.

Mark
Code Below VVV




\define nonDraftTitle()
<$list filter="[all[current]get[draft.of]] [all[current]!regexp[^Draft]]" 
emptyMessage={{!!title}}  variable="mytag" >
\end

\define evalNonDraftTitle()
   <$macrocall $name=nonDraftTitle/>
\end

\define wrapper() [[$(mytag)$]]

\define journalButton()
 <$button
     tooltip={{$:/language/Buttons/NewJournalHere/Hint}}
     aria-label={{$:/language/Buttons/NewJournalHere/Caption}}
     class=<<tv-config-toolbar-class>>
   >
   <$action-sendmessage
     $message="tm-new-tiddler"
     title=<<now "$(journalTitleTemplate)$">>
     tags=<<wrapper>>
   />
   <$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
     {{$:/core/images/new-journal-button}}
   </$list>
   <$list filter="[<tv-config-toolbar-text>prefix[yes]]">
     <span class="tc-btn-text">
       <$text text={{$:/language/Buttons/NewJournalHere/Caption}}/>
     </span>
   </$list>
</$button>

\end

<$list filter="[all[current]get[draft.of]] [all[current]!regexp[^Draft]]" 
emptyMessage={{!!title}}  variable="mytag" >
   <<evalNonDraftTitle>>      <!-- debug -->
   <<journalButton>>
</$list>


On Saturday, November 29, 2014 6:58:01 AM UTC-8, Erwan wrote:
>
>
> Hi everyone, 
>
> I'm trying to create a button based on the "new journal here" which 
> would work even if the current tiddler is in edit mode. I can obtain the 
> real title of the tiddler with: 
>
> <$list filter="[all[current]get[draft.of]]" emptyMessage={{!!title}} /> 
>
> but I didn't find how to pass the result to the "tags" parameter in the 
> action-sendmessage widget. I assume that I need to obtain the result as 
> a string before transmitting it as a parameter, but I'm confused about 
> when a macro or widget is actually evaluated. (I also tried using 
> "macrocall" but probably not the right way) 
>
> This is what I have currently: 
>
> \define nonDraftTitle() 
>    <$list filter="[all[current]get[draft.of]]" emptyMessage={{!!title}} /> 
> \end 
>
> \define evalNonDraftTitle() 
>    <$macrocall $name=nonDraftTitle/> 
> \end 
>
> \define journalButton() 
>    <$button 
>      tooltip={{$:/language/Buttons/NewJournalHere/Hint}} 
>      aria-label={{$:/language/Buttons/NewJournalHere/Caption}} 
>      class=<<tv-config-toolbar-class>> 
>    > 
>    <$action-sendmessage 
>      $message="tm-new-tiddler" 
>      title=<<now "$(journalTitleTemplate)$">> 
>      tags=<<nonDraftTitle>> 
>    /> 
>    <$list filter="[<tv-config-toolbar-icons>prefix[yes]]"> 
>      {{$:/core/images/new-journal-button}} 
>    </$list> 
>    <$list filter="[<tv-config-toolbar-text>prefix[yes]]"> 
>      <span class="tc-btn-text"> 
>        <$text text={{$:/language/Buttons/NewJournalHere/Caption}}/> 
>      </span> 
>    </$list> 
> </$button> 
> \end 
>
> <$set name="currentTiddlerTag" value=<<evalNonDraftTitle>>> 
>    <<evalNonDraftTitle>>      <!-- debug --> 
>    <<journalButton>> 
> </$set> 
>
>
> Thank you! 
> Erwan 
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to