Pardon me for jumping in here, but I think you're making this too hard.

On Wed, 30 May 2007 09:53:11 -0500, kgi <[EMAIL PROTECTED]> wrote:

Yep, I see the attributes for traversing along the hierarchy. Unless I've
misunderstood, in order for a widget's Javascript to be able to call another
widget's Javascript, it has to do something like:

  self.widgetParent.widgetParent.widgetParent ...
childWidgets[0].childWidgets[1].doStuff()


You can certainly do that, but there are plenty of other means of
accomplishing this aim.

For example, a widget has __init__() and nodeInserted() methods that
you can override.  If you want your widget instances accessible by
some name known to you, then just do:

self.widgetParent.someNameILikeToUseForThisParticularWidget = self;

Better still, use a client-side event dispatching mechanism, and
just let interested widget subscribe to a given "channel":

MyDispatcher = {
    _subscribers: [],
    publish: function(channel, message){
        ...
    },
    subscribe: function(channel){
    }
    ...
};

Hopefully, this gives you some easier options to consider.

--
L. Daniel Burr
[EMAIL PROTECTED]

_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

Reply via email to