cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Neo
Neo
Level VI

How to close associated data table with a warning, when chart window is closed ?

I want to show a warning dialog to the user when a chart window is closed and close the associated data table (without saving) if the user selects OK and keep both the data table and the chart, if the user selects "Cancel".

The script below is for the dialog box I want, but where do I need to put the statement for closing [if OK] or keeping [if Cancel] the data table?

gb << On Close(
	New Window( "Are you sure?",
		<<modal,
		V List Box(
			Text Box( "This will close the associated data table" ), 
			H List Box( Button Box( "OK" ), Button Box( "Cancel" ) )
		)
	)["button"] == 1
);

 

When it's too good to be true, it's neither
1 ACCEPTED SOLUTION

Accepted Solutions
hogi
Level XII

Re: How to close associated data table with a warning, when chart window is closed ?

Any reason why you don't use the free upgrade to jmp17?

The new Workflow Builder is really great

Here a version with

<<Modal

which should work on Jmp 16.2

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = dt << Graph Builder(
	<<on close(
		ex = New Window( "message",
			<<Modal,
			V List Box( 
				Text Box( "close?" ),
				H List Box( Button Box( "OK" ), Button Box( "Cancel" ) ) )
		);
		If( ex["button"] == 1,
			Close( (gb << Get Data Table), noSave )
		);
		ex["button"] == 1 // don't close the window if the user doesn't press OK
		;
	),
	Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
	Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
);

 

 

View solution in original post

4 REPLIES 4
hogi
Level XII

Re: How to close associated data table with a warning, when chart window is closed ?

<< on close()

is the right place.
Return 0 if the window should not be closed.

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = dt << Graph Builder(
	<<on close(
		ex = New Window( "message",
			<<Type( "Modal Dialog" ),
			V List Box( 
				Text Box( "close?" ),
				H List Box( Button Box( "OK" ), Button Box( "Cancel" ) ) )
		);
		If( ex["button"] == 1,
			Close( (gb << Get Data Table), noSave )
		);
		ex["button"] == 1 // don't close the window if the user doesn't press OK
		;
	),
	Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
	Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
);

 

Neo
Neo
Level VI

Re: How to close associated data table with a warning, when chart window is closed ?

@hogi . I get the following on JMP 16.2.0.

Cannot subscript Display Box in access or evaluation of 'ex[ /*###*/"button"]' , ex[/*###*/"button"]Cannot subscript Display Box in access or evaluation of 'ex[ /*###*/"button"]' , ex[/*###*/"button"]
When it's too good to be true, it's neither
hogi
Level XII

Re: How to close associated data table with a warning, when chart window is closed ?

Any reason why you don't use the free upgrade to jmp17?

The new Workflow Builder is really great

Here a version with

<<Modal

which should work on Jmp 16.2

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = dt << Graph Builder(
	<<on close(
		ex = New Window( "message",
			<<Modal,
			V List Box( 
				Text Box( "close?" ),
				H List Box( Button Box( "OK" ), Button Box( "Cancel" ) ) )
		);
		If( ex["button"] == 1,
			Close( (gb << Get Data Table), noSave )
		);
		ex["button"] == 1 // don't close the window if the user doesn't press OK
		;
	),
	Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
	Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
);

 

 

Neo
Neo
Level VI

Re: How to close associated data table with a warning, when chart window is closed ?

@hogi Thanks, it works with << modal.

 Any reason why you don't use the free upgrade to jmp17?

We normally test a newer JMP version (for a set duration) on existing JMP scripts before deploying it more widely. 

There have been had several backward compatibility issues in the past some of which have not yet been resolved yet.

(I am still learning JMP but there are others who do the testing)

So, the upshot is we will move to v17 but it wont happen anytime soon so I only have v16.2 at my disposal at the moment :).

 

When it's too good to be true, it's neither