Thanks a bunch Eric, I really appreciate it. Looks like I should search your site more rigorously from now on. :)
On Nov 15, 11:59 pm, Eric Shulman <[EMAIL PROTECTED]> wrote: > > My problem is that it says I am getting too much recursion. > > First, you might save yourself a lot of work by trying this: > http://www.tiddlytools.com/#QuoteOfTheDayPlugin > http://www.tiddlytools.com/#QuoteOfTheDayPluginInfo > > In any case, here's what's wrong with the code you posted: > > * the recursion occurs because you are forcing a refresh of the > tiddler *during* the rendering of the macro. When the tiddler is > refreshed, it re-renders the macro, which forces a refresh, that re- > renders the macro, which forces a refresh, that re-renders the macro, > which forces a refresh, ... etc. > > * The macro handler creates a new DIV element each time it is > invoked. This is the right thing to do when the macro is being first > rendered into the tiddler content. But then, you use a timer to > automatically re-invoke the handler again every 1000ms. > Unfortunately, this means that (if it works at all), you are going to > wind up adding another DIV each time the handler is triggered, rather > than simply updating the DIV that was first created when the macro was > initially rendered. > > A more correct general approach is to use the macro handler to > *create* the DIV and save the list of params, and then invoke a > separate 'tick()' function that is responsible for updating the > display, like this: > -------------------- > config.macros.fader.handler=function > (place,macroName,params,wikifier,paramstring,tiddler) { > this.section=createTiddlyElement(place,"div"); > this.params=params; > this.displaynumber=0; > this.tick();} > > config.macros.fader.tick=function() { > this.section.innerHTML = this.params[this.displaynumber++]; > if (this.displaynumber>this.params.length-1) this.displaynumber=0; > setTimeout("config.macros.fader.tick()",1000);} > > -------------------- > > enjoy, > -e > Eric Shulman > TiddlyTools / ELS Design Studios > > P.S. Although your question topic is not actually about TiddlyWiki > *core* development, it's somewhat overly technical for the general > TiddlyWiki community discussion. In order to avoid confusing people > too much, it might be better to continue this thread (if needed) in > the TiddlyWikiDev GoogleGroup. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/TiddlyWiki?hl=en -~----------~----~----~----~------~----~------~--~---

