[Kst] JS in Kst
Barth Netterfield
netterfield at physics.utoronto.ca
Fri Dec 2 01:05:31 CET 2005
OK. Then I am pretty certain that we are going to want to be able to
reference a plot, or other object, by tagname:
maybe:
children.find("P2")
This will be useful/important for all kstobjects.
cbn
On December 1, 2005 06:47 pm, George Staikos wrote:
> On Thursday 01 December 2005 18:11, Barth Netterfield wrote:
> > I think Andrew was asking "what is the javascript syntax for closing a
> > plot named "P2" from within the JS console (which should be the same as
> > doing it from within a script).
>
> Oh, I did not understand that. It's all in the KstScript docs. It all
> starts in the "Kst" object. From there, you can get a reference to the
> windowCollection ("windows"), the view for that window ("view" - it's a bug
> in the docs online right now), and then recurse through the tree with
> "children".
>
> Example:
> w = Kst.windows[0];
> children = w.view.children;
> for (i = 0; i < children.count(); ++i) {
> if (children[i].tagName == "MyPlot") {
> doIt(children[i]);
> break;
> }
> }
>
> I didn't test running this but it should ~work.
More information about the Kst
mailing list