Hi,
I click on a box in a hierarchical diagram.
How can I know (using JSL) which box has been selected?
Thanks.
Shaul.
As I said already, I'm not sure what behaviour you are looking for nor, at a higher level, of what you want to acomplish (there's almost always more than one way to deliver the desired functionality). Not knowing the latter, this slight modification of the example above may or may not help.
Names Default To Here( 1 ); Diagram( hierarchy( Hier Box( bb1 = Button Box( "Great Grand Parent", Speak(bb1<<getButtonName), <<underlineStyle ), Hier Box( bb2 = Button Box( "Grand Parent 1", Speak(bb2<<getButtonName), <<underlineStyle ), Hier Box( bb3 = Button Box( "Parent 1", Speak(bb3<<getButtonName), <<underlineStyle ), ), Hier Box( bb4 = Button Box( "Parent 2", Speak(bb4<<getButtonName), <<underlineStyle ) ), ), Hier Box( bb5 = Button Box( "Grand Parent 2", Speak(bb5<<getButtonName), <<underlineStyle ), Hier Box( bb6 = Button Box( "Parent 3", Speak(bb6<<getButtonName), <<underlineStyle ), Hier Box( bb7 = Button Box( "Child 1", Speak(bb7<<getButtonName), <<underlineStyle ) ), Hier Box( bb8 = Button Box( "Child 2", Speak(bb8<<getButtonName), <<underlineStyle ) ) ), Hier Box( bb9 = Button Box( "Parent 4", Speak(bb9<<getButtonName), <<underlineStyle ) ) ) ) ) );
OK! it works. Thanks a lot. Here's the JSL that swiches "h2" on and off.
namesdefaulttohere(1); shw2=1; w=newwindow("w", h1=hierbox("h1", b2=buttonbox("b2", shw2=1-shw2; h2<<visibility( if(shw2==0, "hidden", "visible" ) ) ), h2=hierbox("h2", h3=hierbox("h3") ) ) ); h1<<ChangeType("hierarchy");
Probably more details are required to give a sensible response. How, exactly, did you generate the diagram, please?
Here's a simple code:
w=newwindow("w", h1=hierbox("h1", h2=hierbox("h2", h3=hierbox("h3") ) ) );
Now, when I get the diagram and click on one of the boxes, I'd like to know exactly which box has been selected.
Of course, My question referes to an automatic identification by JSL
I'd like to make my point clear.
Suppose I create a diagram. In that diagram, I 'd like to hide any selected box.
I could do it if I had something like "Is Selected" property of the HierBox which, it seems, I don't have.
So I will demonstrate the idea as if I could have a variable (shw) indicating the selection of "h2" (HierBox #2):
shw=1; w=newwindow("w", h1=hierbox("h1", h2=hierbox("h2", <<visibility( if(shw==0, "hidden", "visible" ) ), h3=hierbox("h3") ) ) );
Since shw=1, the diagram is completely shown, However, shw=0, "h2" and "h3" are hidden and only "h1" is shown..
Select Help > Scripting Index. Change browser to show Display Boxes. Select HierBox in the first list. I do not find anything in the proctocol for this object that directly addresses your need.
You can also use Show Properties( HierBox() ) and examine the Log.
This object is self-contained in the case of editing actions. None of the editing or change states are surfaced to JSL.
Thanks. Indeed there is no direct way to address my need.
However, I will redefine my need, maybe for the developers of JMP, for future versions:
The need is to be able to open or to close parts of a diagram, just like it can be doen with OUTLINEBOXes.
Again, Thank you both.