Tinderbox Forum

Is there a way to manually fire the OnAdd action of an adornment?


(George Wyner) #1

The context: I have TBX file which I use for course planning. I have a container in which each adornment represents a class date and there are notes on that adornment for various resources used in that class (assignments, readings, slides). I set EndDate in the adornment to the date of the class. I have an OnAdd action which sets the EndDate of each note added to match.

I should have thought ahead to when I am re-using this approach for a new year. The enddates change for the new semester but they don’t propagate to the notes on the adornment since the OnAdd doesn’t fire.

I can drag the notes off and on again but there are a lot of them and a dense array of adornments so it is a bit clunky to do so.

I saw an intriguing reference in atbref to the adornment designator now working outside of an OnAdd action. I tried setting $EndDate = $EndDate(adornment) in a stamp but when I applied it to a note that is clearly on an adornment the $EndDate got set to never.

Wanted to check if this should be working (so I can look into what I might have done wrong).

May need to move to a different approach, although the visual of the current system works well.

Thanks for any advice!

George


(Mark Anderson) #2

Re the aTbRef note, tracking back it appears to apply to a change in v5.6.0 (see). Of course, the codebase was re-written, so the described functionality possibly broke since v5 but it has passed unnoticed as it is a less common use of the designator which originally was intended for use in an adornment’s queries/actions as opposed to code acting on a note upon an adornment.

Still, I confirm the stamp you describe doesn’t work. Noted for @eastgate


(George Wyner) #3

My work around is to bulk drag off and then on and, to catch any notes that didn’t get updated for any reason, use attribute view to review EndDates.


(Mark Anderson) #4

FWIW, I’ve confirmed such a stamp does work in v5 and breaks in v6 and forwarded detailed findings on to support.

So for now, you’ll have to stick with the work around.

The trick is to use prototypes. That way you set the basic parameters like the start date, day of week, etc. and the (inherited) action code figures out the rest. I’m buried in something right now. Can anyone else link to a good example of this? ISTR this sort of thing used to turn up on the old forum quite often.