Who's Yo Daddy?

4 views
Skip to first unread message

DigitalOrganics

unread,
Jun 2, 2006, 8:37:57 AM6/2/06
to TiddlyWiki
I've got more questions! :-) When you embed tiddlers into each other,
how do you get macros within the embedded tiddlers to "know about" the
parent tiddler? Is this even possible? More specifically, I'm trying to
put a moveable panel into each tiddler by embedding a tiddler
containing the moveable panel into the viewtemplate. I call macros
within the moveable panel but they need to be aware of the parent
tiddler and not the tiddler than holds the panel, if I'm making any
sense here. Let me know if I'm speaking gobblygook, thanks.

Saq Imtiaz

unread,
Jun 2, 2006, 9:55:53 AM6/2/06
to Tiddl...@googlegroups.com

As far as I remember, the toggleTag macro lets you specify the target tiddler, that should take care of your problem.
But, what is that you are trying to accomplish? I cant help but think that whatever it is, there has to be an easier way!

Cheers,
Saq
 

Saq Imtiaz

unread,
Jun 2, 2006, 9:56:35 AM6/2/06
to Tiddl...@googlegroups.com
On 6/2/06, DigitalOrganics <digital...@gmail.com> wrote:

PS: I think you will greatly increase your chances of a reply if you make your subject lines a little more descriptive of the post itself. ;)




DigitalOrganics

unread,
Jun 2, 2006, 10:08:20 AM6/2/06
to TiddlyWiki

I want a button at the top of the toolbar for each tiddler that pops
out a moveable panel (Eric's plugin) and within this moveable panel I
want to call my macro (thundertag) or any other macro I so choose.
However, this macro needs to apply to the current tiddler and not the
tiddler that holds the moveable panel. Even if toggleTag takes in a
target reference, how am I to tell it ahead of time which tiddler is
going to be the parent (that is, the tiddler with the embedded moveable
panel)? Thanks.

> >
>
> ------=_Part_6067_14434505.1149256553293
> Content-Type: text/html; charset=ISO-8859-1
> X-Google-AttachSize: 1344
>
> <br><br><div><span class="gmail_quote">On 6/2/06, <b class="gmail_sendername">DigitalOrganics</b> &lt;<a href="mailto:digital...@gmail.com">digital...@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> <br>I've got more questions! :-) When you embed tiddlers into each other,<br>how do you get macros within the embedded tiddlers to &quot;know about&quot; the<br>parent tiddler? Is this even possible? More specifically, I'm trying to
> <br>put a moveable panel into each tiddler by embedding a tiddler<br>containing the moveable panel into the viewtemplate. I call macros<br>within the moveable panel but they need to be aware of the parent<br>tiddler and not the tiddler than holds the panel, if I'm making any
> <br>sense here.</blockquote><div><br>As far as I remember, the toggleTag macro lets you specify the target tiddler, that should take care of your problem.<br>But, what is that you are trying to accomplish? I cant help but think that whatever it is, there has to be an easier way!
> <br><br>Cheers,<br>Saq<br>&nbsp;</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Let me know if I'm speaking gobblygook, thanks.<br><br>
> <br>
> ------=_Part_6067_14434505.1149256553293--

DigitalOrganics

unread,
Jun 2, 2006, 10:09:39 AM6/2/06
to TiddlyWiki

Saq Imtiaz wrote:

> PS: I think you will greatly increase your chances of a reply if you make
> your subject lines a little more descriptive of the post itself. ;)
>

Thanks Saq.

Eric Shulman

unread,
Jun 2, 2006, 10:35:06 AM6/2/06
to TiddlyWiki
> target reference, how am I to tell it ahead of time which tiddler is
> going to be the parent (that is, the tiddler with the embedded moveable
> panel)? Thanks.

Macro handlers are automatically passed a 'place' parameter that
identifies the 'containing DOM element' into which the macro can
produce output (by adding its own DOM elements)

Within the macro handler code, you can use:
story.findContainingTiddler(place)
to loop through successive parent DOM elements of 'place' until it
finds the containing tiddler element. Note that this function returns
a *DOM element*, not a tiddler object. To get the tiddler object, you
can use something like this:
var here=story.findContainingTiddler(place);
if (here) var title=here.getAttribute("tiddler");
if (title) var tiddler=store.getTiddler(title);

This same code can also be used with inline javascript (enabled by the
InlineJavascriptPlugin). The script plugin automatically defines
'place' for you...
for example:
<script>
var here=story.findContainingTiddler(place);
if (here) var title=here.getAttribute("tiddler");
if (title) var tiddler=store.getTiddler(title);
return title+" is "+tiddler.text.length+" bytes long";
</script>


HTH,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

DigitalOrganics

unread,
Jun 2, 2006, 11:17:59 AM6/2/06
to TiddlyWiki
I see now. Thanks. I noticed you used this technique in the
TidIDECommand too.

Simon Baird

unread,
Jun 2, 2006, 7:35:36 PM6/2/06
to Tiddl...@googlegroups.com
Try this:
var yourDaddy = story.findContainingTiddler(place).getAttribute("tiddler")
that's a string so store.getTiddler(yourDaddy) if you need to get the tiddler data.

Sounds like you are working on something interesting!

Simon.

On 6/2/06, DigitalOrganics <digital...@gmail.com> wrote:



--
Simon Baird <simon...@gmail.com>
Reply all
Reply to author
Forward
0 new messages