Hi All,
I was working on coding for a different subject when I needed to search the community for some support, but I came across this post from many years ago and it got me wondering, could it be done (there was no solution to the original post)? Can Outline boxes be assigned a function so that depending on their open/close state, it will close/open other outline boxes? If another outline box is opened, can the window automatically update to close all other outline boxes, except the one that was just opened?
I tried several different approaches, and although you can define a function within an outline box, see the example below. You apparently can't refer to another outline box within the function call (JMP complains about a deleted reference to the other outline boxes), and Outline Box() doesn't accept the send command <<Set Function(Function({this}, script)).
Names Default To Here( 1 );
w = New Window( "My Window",
A = Outline Box( "Panel Box A",
H List Box( Button Box( "A1" ), Button Box( "A2" ), Button Box( "A3" ) ),
AFunc = Function( {this},
x = this + 2;
Show( x );
);
AFunc( 7 );
),
B = Outline Box( "Panel Box B", H List Box( Button Box( "B1" ), Button Box( "B2" ), Button Box( "B3" ) ), <<Close( 1 ) ),
C = Outline Box( "Panel Box C", H List Box( Button Box( "C1" ), Button Box( "C2" ), Button Box( "C3" ) ), <<Close( 1 ) )
);
The above script gives the following output:
It clearly generates the desired window and displays the output of the function, which is x=9. But, I was unsuccessful in trying to create a function within the Outline Box that accessed the state of another Outline Box and dynamically closed/opened accordingly.
In short, the answer to my above question (and the original post) is No (or at least not yet, or also at least that I've found a way to do so). The long answer is more fun, and is Yes (mostly, with a workaround).
Something that is very close to what the original post was requesting is in the below code where I add some "prev" and "next" button boxes that will close the current Outline Box and then open the previous (cyclical) or next Outline Box. So, it's not technically the desired solution, but it accomplishes (more or less) what is needed.
The only downside is that you can't skip from let's say having Outline Box A open to opening Outline Box C and it dynamically updates the window by closing all other Outline Boxes, except C. I can imagine some situations where having this functionality to an Outline Box would be very helpful. Maybe it could be a future feature in new releases of JMP?
Anyway, I thought the original post was interesting and wanted to investigate that path a little before getting back to my other work.
Thanks!,
DS
Code for the "workaround":
Names Default To Here( 1 );
w = New Window( "My Window",
A = Outline Box( "Outline Box A",
V List Box(
H List Box( Button Box( "A1" ), Button Box( "A2" ), Button Box( "A3" ) ),
H List Box(
Button Box( "prev",
<<Style( "Underline" ),
<<Set Function(
Function( {},
A << Close( 1 );
B << Close( 1 );
C << Set Open( 1 );
)
)
),
Button Box( "next",
<<Style( "Underline" ),
<<Set Function(
Function( {},
A << Close( 1 );
B << Set Open( 1 );
C << Close( 1 );
)
)
)
)
)
),
B = Outline Box( "Outline Box B",
V List Box(
H List Box( Button Box( "B1" ), Button Box( "B2" ), Button Box( "B3" ) ),
H List Box(
Button Box( "prev",
<<Style( "Underline" ),
<<Set Function(
Function( {},
A << Set Open( 1 );
B << Close( 1 );
C << Close( 1 );
)
)
),
Button Box( "next",
<<Style( "Underline" ),
<<Set Function(
Function( {},
A << Close( 1 );
B << Close( 1 );
C << Set Open( 1 );
)
)
)
)
),
<<Close( 1 )
),
C = Outline Box( "Outline Box C",
V List Box(
H List Box( Button Box( "C1" ), Button Box( "C2" ), Button Box( "C3" ) ),
H List Box(
Button Box( "prev",
<<Style( "Underline" ),
<<Set Function(
Function( {},
A << Close( 1 );
B << Set Open( 1 );
C << Close( 1 );
)
)
),
Button Box( "next",
<<Style( "Underline" ),
<<Set Function(
Function( {},
A << Set Open( 1 );
B << Close( 1 );
C << Close( 1 );
)
)
)
)
),
<<Close( 1 )
)
);