cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Andyon98
Level II

I have a "Do you want to quit button" with ""Yes" and "No" buttons. How do I close the window along with the main menu from which I press cancel from?

I was wondering how would I close all windows from pressing on the yes button, im sure its simple... im just not sure on how to write it the most efficient way.

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: I have a "Do you want to quit button" with ""Yes" and "No" buttons. How do I close the window along with the main menu from which I press cancel from?

Not exactly sure what you are after, but maybe something like this?

Names Default To Here(1);

nw1_expr = Expr(
	New Window("1",
		Text Box("Window1"),
		H List Box(
			Button Box("OK"),
			Button Box("Cancel", << Set Function(function({this},
				(this << top parent) << Close Window;
				nw2_expr;
			)))
		)
	);
);

nw2_expr = Expr(
	New Window("2",
		Text Box("Window2"),
		H List Box(
			Button Box("OK"),
			Button Box("No", << Set Function(function({this},
				(this << top parent) << Close Window;
				nw1_expr;
			)))
		)
	);
);

nw1_expr;
-Jarmo

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: I have a "Do you want to quit button" with ""Yes" and "No" buttons. How do I close the window along with the main menu from which I press cancel from?

Here is a bit of JSL that seems to close all of the windows and then closes JMP.  There may be easier ways.

Names Default To Here( 1 );
cw = Current Window() << get window title;

For( i = 99, i >= 1, i--,
	If( Window( i ) << get window title != cw & Window( i ) << get window title != "",
		Window( i ) << close window
	)
);
Main Menu( "exit jmp" );
Jim
Andyon98
Level II

Re: I have a "Do you want to quit button" with ""Yes" and "No" buttons. How do I close the window along with the main menu from which I press cancel from?

Say I don’t want to close jmp and I only want to close one window at a time; e.g.

You press cancel on the first window and another window pops up, at this point you want the first window to close as the second window has opened.

Then if you press on the “No” button box of the second menu, the second menu should close and the first menu should open again or you should be presented with the first menu again.
jthi
Super User

Re: I have a "Do you want to quit button" with ""Yes" and "No" buttons. How do I close the window along with the main menu from which I press cancel from?

Not exactly sure what you are after, but maybe something like this?

Names Default To Here(1);

nw1_expr = Expr(
	New Window("1",
		Text Box("Window1"),
		H List Box(
			Button Box("OK"),
			Button Box("Cancel", << Set Function(function({this},
				(this << top parent) << Close Window;
				nw2_expr;
			)))
		)
	);
);

nw2_expr = Expr(
	New Window("2",
		Text Box("Window2"),
		H List Box(
			Button Box("OK"),
			Button Box("No", << Set Function(function({this},
				(this << top parent) << Close Window;
				nw1_expr;
			)))
		)
	);
);

nw1_expr;
-Jarmo
Andyon98
Level II

Re: I have a "Do you want to quit button" with ""Yes" and "No" buttons. How do I close the window along with the main menu from which I press cancel from?

That's exactly what I was looking for, thank you!