Re: [Tb] inheriting attribute from ancestor (parent)

From: Mark Anderson <mac_at_yeardley.demon.co.uk>
Date: Mon, 16 Apr 2007 15:23:06 +0100

On 16/4/07 10:13, "rodney tamblyn" <rodney_at_oceanbrowser.com> wrote:

> I have a prototype "article" (for journal articles) which has a number of
> attributes such as authour, title, journal etc.  I want to manage quotations
> as separate entries under the  article (child), using (for example) a
> prototype "quotation"
>
> I'd like the quotation prototype entries to inherit relevant values from their
> parent.
>
> In the quotation prototype, onAdd action, I've tried setting:
>
> jAuthour=^getFor(ancestor,jAuthour)^
> jAuthour=^getFor(parent,jAuthour)^
>
> But when I create a new quotation by clicking on an article and select "New
> child" the newly created quotation does not inherit values from it's parent.
>
> What am I doing wrong?
>
> Thanks
>
> ~ Rodney
>
It looks like youıre setting the OnAdd action in the *child* note. Adding a
note fires itıs parentıs OnAdd action not the OnAdd of the note being added.
Makes sense if you think it through. If you want actions to occur in the
new child when it is added, then shift your code from the OnAdd attribute to
the Rule attribute. On being created, the new child note asserts its Rule
setting jAuthor from the noteıs parent.

This code would be incorrect in any case: ^getFor(ancestor,jAuthour)^. This
is because Œancestorı is a group object and youıre looking to set a value
based on a single given predecessor: parent, root, grandparent, or cover
would work. See the following aTbRef pages that list single/group objects:
http://www.acrobatfaq.com/tbx/index/objectsc/itemobje.html
http://www.acrobatfaq.com/tbx/index/objectsc/groupobj.html

---
Regards

Mark Anderson
Tinderbox wiki gardener

Tinderbox Wiki: http://www.eastgate.com/wiki2/wiki.cgi?TinderboxWiki
aTbRef: http://www.acrobatfaq.com/tbx/index.html
Received on Mon Apr 16 2007 - 10:23:14 EDT

This archive was generated by hypermail 2.2.0 : Thu Sep 20 2007 - 17:05:37 EDT