On Tuesday, December 24, 2019 at 7:45:17 AM UTC-8, LinOnetwo wrote:
>
> I try to use following checkbox, I want the state be sync to my plugin.
> <$checkbox checkactions="checkUseServerStoryList"
> uncheckactions="unCheckUseServerStoryList"
> >
> <$action-sendmessage $name="checkUseServerStoryList"
> $message="tm-solid-useServerStoryList" />
> <$action-sendmessage $name="unCheckUseServerStoryList"
> $message="tm-solid-notUseServerStoryList" />
> <<lingo UseServerStoryList>>
> </$checkbox>
>
>
That is not the correct way to invoke actions from widgets.
$action-sendmessage widget does not recognize or use a $name parameter.
Rather, you must use the "\define" syntax to declare the actions as macros
to give them names. Place the following at the start of the tiddler:
\define checkUseServerStoryList()
<$action-sendmessage $message="tm-solid-useServerStoryList" />
\end
\define uncheckUserServerStoryList()
<$action-sendmessage $message="tm-solid-notUseServerStoryList" />
\end
Then, in your checkbox widget, you would write:
<$checkbox checkactions=<<checkUseServerStoryList>> uncheckactions=<
<unCheckUseServerStoryList>> >
<<lingo UseServerStoryList>>
</$checkbox>
Alternatively, if you prefer to have the checkbox AND actions written
together, you can forego the use of names altogether, and place the actions
in-line, within the checkbox syntax, like this:
<$checkbox
checkactions="""<$action-sendmessage
$message="tm-solid-useServerStoryList" />"""
uncheckactions="""<$action-sendmessage
$message="tm-solid-notUseServerStoryList" />""" >
<<lingo UseServerStoryList>>
</$checkbox>
Note that, because the action-sendmessage widget uses double-quotes around
the $message parameter, you must use TRIPLED double-quotes surrounding the
checkactions and uncheckactions parameters of the checkbox widget.
The first syntax (using \define) is recommended.
That should do it. Let me know how it goes...
enjoy,
-e
Eric Shulman
InsideTiddlyWiki - http://www.TiddlyTools.com/InsideTW
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywikidev/9f5a598f-cbfa-4116-8e6e-05b566ff7ae1%40googlegroups.com.