cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Craige_Hales
Super User

Tiny JSL Challenge: Escape from Modal OnClose(0)

in Display number of selected rows in the new window   I gave a solution that uses the <<OnClose(...) function and noted that the script ends with ;1 so the window can actually close. If it ends with ;0 the window will not close, and because it is a modal window, you are

 

  • stuck
  • caught between a rock and a hard place
  • painted into a corner

 

Because this example uses Graph Builder and a Data Table, there is a way out (without using Task Manager to kill JMP.)

Can you find it?  Save your work before starting!

 

Replies here are OK, maybe there is more than one way...spoiler/solution follows.

 

Craige
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Tiny JSL Challenge: Escape from Modal OnClose(0)

My solution (different from @Craige_Hales solution):

View more...
After some playing around I started thinking that I can most likely manipulate the buttons and use those to close the window. I took fairly easy way out and set following script to OK button
Set Function(Function({this},
	((this << top parent) << On Close(1)
)))
You cannot simply set this by right clicking, but you can right click around and find one Show Properties -> Find the correct button box from the list and then set some simple action to Press

jthi_0-1657557857632.png

after setting something to the press you can right click on the button and modify script it runs

jthi_1-1657557890185.png
Then Set Script which will modify the modal windows on close to return always 1, press OK and modal will close

 

-Jarmo

View solution in original post

4 REPLIES 4
jthi
Super User

Re: Tiny JSL Challenge: Escape from Modal OnClose(0)

My solution (different from @Craige_Hales solution):

View more...
After some playing around I started thinking that I can most likely manipulate the buttons and use those to close the window. I took fairly easy way out and set following script to OK button
Set Function(Function({this},
	((this << top parent) << On Close(1)
)))
You cannot simply set this by right clicking, but you can right click around and find one Show Properties -> Find the correct button box from the list and then set some simple action to Press

jthi_0-1657557857632.png

after setting something to the press you can right click on the button and modify script it runs

jthi_1-1657557890185.png
Then Set Script which will modify the modal windows on close to return always 1, press OK and modal will close

 

-Jarmo
Craige_Hales
Super User

Re: Tiny JSL Challenge: Escape from Modal OnClose(0)

@jthi  solution is better; it only needs the OK button. Thanks!

Craige
David_Burnham
Super User (Alumni)

Re: Tiny JSL Challenge: Escape from Modal OnClose(0)

Out of curiosity: why does OnClose even set this flag, isn't that the purpose of OnValidate?

-Dave
Craige_Hales
Super User

Re: Tiny JSL Challenge: Escape from Modal OnClose(0)

On Validate is tied to the OK button; you can cancel without validating.

On Close is tied to the window preparing to close, for any reason.

You can probably use both, but I'd be hard pressed to come up with a good reason.

 

At the OS level, https://docs.microsoft.com/en-us/windows/win32/learnwin32/closing-the-window shows there is another interesting hook when the window has disappeared off the display and is about to be destroyed (WM_DESTROY). JMP does not expose this event.

Craige