JMP window not closingI'm working on a script that just does basic image editing. I have my image in one window, then clicking an "Image Options" window opens up a window with sliders for contrast and brightness. Whenever I close the image options window, it never actually closes, the window is just hidden. Hitting the "x" in the corner does nothing. I even added a "Close" button that just says << Close Window, but then it just hides it. In order to get it to close, I have to close JMP completely. Is there something I'm missing?
Names Default To Here( 1 );
img = Open( "$SAMPLE_IMAGES/windmap.png", "png" );
orig = New Image( img );
wind = New Image( orig );
slbval = 1;
slbval1 = 1;
w = New Window( "View Image",
vlb = V List Box(
Graph Box(
FrameSize( 500, 500 ),
X Scale( 0, 100 ),
Y Scale( 0, 100 ),
<<ADD image=""></ADD>
Re: JMP window not closingHi @pen51,
You could add 1 to the On Close argument.
<< On Close ( optionswindowopen = 0; 1)
This way it will return the result of the last argument; in this case 1.
cheers,
Stan
Re: JMP window not closing@stan_koprowski has pointed you in the right direction and you ask a good question and the answer points to a subtlety of JSL.
The key is to remember that everything in JSL is a function, even operators like = which is equivalent to the Assign() function. Since everything is a function, they all return something. The Assign() function returns the value being assigned.
So, because your OnClose() argument is an Assign() function that assigns 0, and because the Assign() function returns the value being assigned it returns 0, and because On Close() says that the window won't close if the function being called returns 0 the window will never close.
However, since everything is a function, the ; operator is actually the Glue() function. The Glue() function returns the result of it's last argument. So, you can workaround this by doing anything else in your On Close() script after the assignment, like just putting a 1.
So, this will work for you:
imgop = New Window( "Image Options",
<<ON close=""></ON>
Re: JMP window not closingHi Stan, the optionswindowopen is just a boolean to say whether or not the window is open. Since I'm closing the window, on On Close would set the boolean to 0. If the window is open, the boolean is 1. I would like to keep this boolean with this logic, so do you have a work around?
Re: JMP window not closingHi @pen51,
The issue with the script is on line 32:
<<ON close=""></ON>
The window will never close when set to 0.
If you change to
<<ON close=""></ON>
It closes as expected.
According to the scripting index if the << On Close() returns zero (0) the window is prevented from closing.
<<On Close<<On Close<
cheers,
Stan
Re: JMP window not closing@pen51,
I tested this script on JMP 13.1.0 and had the same issue.
Re: JMP window not closingI've been in contact with JMP support, but the technician I talked to could not replicate the problem with the same script. I'm running JMP 13.1, @cwillden what are you running? I'll try to update and see if it works, but hopes are not high since @txnelson also had this problem in JMP 14.
Re: JMP window not closinglol, I had the same happen in JMP 13. Thanks @pen51 for infecting our computers as well with your strange unintentional virus (j/k).
Re: JMP window not closingThis is very curious.....I played around with it, and could not find any consistant reason for the options window being able to be closed. In fact, under JMP 14, my JMP session would not close. I had to force an operating system close.
This needs to be sent to the JMP support folks....
support@jmp.com