<$button message="tm-modal" param="ModalImage" set="$:/state/currentImage" setTo="http://www.picturesnew.com/media/images/3cc4cc5ef7.jpg"> [img width="100" [http://www.picturesnew.com/media/images/3cc4cc5ef7.jpg]] </$button>and create the Tiddler "ModalImage" with this content:
(..or similiar, this is just the template to display the image)<img src={{$:/state/currentImage}} />
\define lightBox(img, template) <$button message="tm-modal" param="$template$" set="$:/state/currentImage" setTo="$img$"> [img width="100" [$img$]] </$button> \end \define lightBoxWithFixedTemplate(img) <<lightBox "$img$" "ModalImage">> \endWhich you then can use like this:
or alternatively this:<<lightBox "http://www.picturesnew.com/media/images/3cc4cc5ef7.jpg" "test">>
<<lightBoxWithFixedTemplate "http://www.picturesnew.com/media/images/3cc4cc5ef7.jpg" >>
--
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 post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.
under the assumption that you only have one Lightbox open at a time (and don't stack them), you could archieve the behaviour you want with this:
Is there a way for me to pass a caption to the ModalImage tiddler in addition to the image source?
$:/lightBox/currentImage and
set its type to 'Data Dictionary'. \define lightBox(img, caption, template)
<$button message="tm-modal" param="$template$"
set="$:/lightBox/currentImage" setTo="
img: $img$
caption: $caption$">
[img width="100" [$img$]]
</$button>
\end
\define lightBoxWithFixedTemplate(img, caption)
<<lightBox "$img$" "$caption$"
"ModalImage">>
\end<img src={{$:/state/currentImage##img}} />
{{$:/state/currentImage##caption}}\define lightBox(img, caption, template)
<$setfield tiddler="$:/state/currentImage"
set="!!caption" setTo="$caption$" message="tm-modal"
param="$template$">
<$setfield tiddler="$:/state/currentImage"
set="!!img" setTo="$img$">
<$button message="tw-set-field">
[img width="100" [$img$]]
</$button>
</$setfield>
</$setfield>
\end<img src={{$:/state/currentImage!!img}} />
{{$:/state/currentImage!!caption}}Some time ago Matabele published a set of various useful widgets that are capable of emitting messages. In particular, one could redesign the lightbox macro with help of his SetField widget: