[Kst] JS in Kst

George Staikos staikos at kde.org
Fri Dec 2 00:47:43 CET 2005


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.

-- 
George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/


More information about the Kst mailing list