cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
%3CLINGO-SUB%20id%3D%22lingo-sub-510545%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%A6%82%E4%BD%95%E9%97%9C%E9%96%89%E2%80%9C%E6%96%B0%E8%A6%96%E7%AA%97%E2%80%9D%EF%BC%9F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-510545%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E6%88%91%E4%B8%80%E7%9B%B4%E5%9C%A8%E5%98%97%E8%A9%A6%E9%97%9C%E9%96%89%E6%96%B0%E7%AA%97%E5%8F%A3%EF%BC%8C%E4%BD%86%E6%88%90%E5%8A%9F%E4%BA%86%EF%BC%8C%E7%82%BA%E4%BA%86%E8%AB%96%E8%AD%89%EF%BC%8C%E6%88%91%E5%98%97%E8%A9%A6%E4%BA%86%20x%20%3D%20New%20Window(%20*some%20code*)%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EClose(x)%3B%0Ax%20%26lt%3B%26lt%3B%20Close()%3B%0Ax%20%26lt%3B%26lt%3B%20Close%3B%0Ax%20%26lt%3B%26lt%3B%20Close%20Window()%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CBR%20%2F%3E%E4%BB%BB%E4%BD%95%E5%B9%AB%E5%8A%A9%E5%B0%87%E4%B8%8D%E5%8B%9D%E6%84%9F%E6%BF%80%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-510545%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3E%E9%80%B2%E9%9A%8E%E7%B5%B1%E8%A8%88%E5%BB%BA%E6%A8%A1%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3E%E6%B6%88%E8%B2%BB%E8%80%85%E8%88%87%E5%B8%82%E5%A0%B4%E7%A0%94%E7%A9%B6%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3E%E5%93%81%E8%B3%AA%E5%92%8C%E5%B7%A5%E8%97%9D%E5%B7%A5%E7%A8%8B%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-518128%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E8%A6%86%EF%BC%9A%E5%A6%82%E4%BD%95%E9%97%9C%E9%96%89%E3%80%8C%E6%96%B0%E8%A6%96%E7%AA%97%E3%80%8D%EF%BC%9F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-518128%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E9%80%99%E6%98%AF%E9%97%9C%E6%96%BC%E9%97%9C%E9%96%89%E8%A6%96%E7%AA%97%E7%9A%84%E5%8F%A6%E4%B8%80%E5%80%8B%E5%95%8F%E9%A1%8C%E3%80%82%E5%81%87%E8%A8%AD%E6%82%A8%E9%96%8B%E5%95%9F%E4%BA%86%E8%B3%87%E6%96%99%E9%9B%86%EF%BC%8C%E7%95%B6%E4%BD%BF%E7%94%A8%E8%80%85%E6%8C%89%E4%B8%80%E4%B8%8B%E3%80%8C%E7%A2%BA%E5%AE%9A%E3%80%8D%E6%88%96%E3%80%8C%E5%8F%96%E6%B6%88%E3%80%8D%E6%99%82%EF%BC%8C%E6%9C%83%E5%9F%B7%E8%A1%8C%E9%97%9C%E9%96%89%E8%B3%87%E6%96%99%E9%9B%86%E7%9A%84%E6%93%8D%E4%BD%9C%E3%80%82%E4%BD%86%E6%98%AF%EF%BC%8C%E5%A6%82%E6%9E%9C%E4%BD%BF%E7%94%A8%E8%80%85%E9%BB%9E%E6%93%8A%E9%97%9C%E9%96%89%E8%A6%96%E7%AA%97%E6%8C%89%E9%88%95%EF%BC%88%E5%8F%B3%E4%B8%8A%E8%A7%92%E7%9A%84%20X%EF%BC%89%E6%80%8E%E9%BA%BC%E8%BE%A6%EF%BC%9Fon%20close()%20%E5%87%BD%E6%95%B8%E8%B2%A0%E8%B2%AC%E8%99%95%E7%90%86%E5%AE%83%E3%80%82%E9%80%99%E6%98%AF%E4%B8%80%E5%80%8B%E4%BE%8B%E5%AD%90%EF%BC%9A%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%2F%2F%20Build%20a%20display%20window%20for%20ftab_box%0Aftab_window%20%3D%20New%20Window(%22Frequency%20Tab%22%2C%20%26lt%3B%26lt%3B%20on%20close(close(ftab_dataset%2C%20nosave))%2C%0A%20H%20List%20Box(%0A%20%20Button%20Box(%22Save%20to%20MSWord%22%2C%0A%20%20%20ftab_output%20%26lt%3B%26lt%3B%20Save%20MSWord(%22%22%2C%20Native)%3B%0A%20%20)%2C%0A%20%20Text%20Box(%20%22%20%20%20%22%20)%2C%0A%20%20Button%20Box(%20%22Close%20this%20Window%22%2C%20%0A%20%20%20%20%20ftab_window%20%26lt%3B%26lt%3B%20CloseWindow%3B%20%0A%2F%2F%20%20%20%20%20close(ftab_dataset%2C%20nosave)%3B%20%2F%2F%20This%20gets%20run%20by%20on%20close%20above%0A%20%20%20%20%20)%2C%0A%20)%2C%0A%20ftab_output%20%3D%20vlistbox(%0A%20%20outlinebox(ftab_title%2C%0A%20%20%20ftab_box)%2C%0A%20)%2C%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-510562%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E8%A6%86%EF%BC%9A%E5%A6%82%E4%BD%95%E9%97%9C%E9%96%89%E3%80%8C%E6%96%B0%E8%A6%96%E7%AA%97%E3%80%8D%EF%BC%9F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-510562%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E9%80%99%E6%98%AF%E4%B8%80%E5%80%8B%E7%A8%8D%E5%BE%AE%E8%A4%87%E9%9B%9C%E7%9A%84%E7%AF%84%E4%BE%8B%EF%BC%8C%E5%B1%95%E7%A4%BA%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E3%80%8C%E7%A2%BA%E5%AE%9A%E3%80%8D%E6%88%96%E3%80%8C%E5%8F%96%E6%B6%88%E3%80%8D%E6%8C%89%E9%88%95%E9%97%9C%E9%96%89%E9%9D%9E%E6%A8%A1%E5%BC%8F%E8%A6%96%E7%AA%97%E3%80%82%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Enw%20%3D%20new%20window(%22Test%22%2C%0A%20textbox(%22Hello%20World%22)%2C%0A%20panelbox(%22Actions%22%2C%0A%20%20hlistbox(%0A%20%20%20okb%20%3D%20button%20box(%22OK%22%2C%20%26lt%3B%26lt%3B%20set%20icon(%22Go%22)%2C%0A%20%20%20%20set%20script(%0A%20%20%20%20%20show(%22Clicked%20OK%22)%3B%0A%20%20%20%20%20%2F%2F%20Other%20OK%20actions%20here%0A%20%20%20%20%20nw%20%26lt%3B%26lt%3B%20close%20window()%3B%0A%20%20%20%20)%2C%0A%20%20%20)%2C%0A%20%20%20canb%20%3D%20button%20box(%22Cancel%22%2C%20%26lt%3B%26lt%3B%20set%20icon(%22Stop%22)%2C%0A%20%20%20%20set%20script(%0A%20%20%20%20%20show(%22Clicked%20Cancel%22)%3B%0A%20%20%20%20%20nw%20%26lt%3B%26lt%3B%20close%20window()%3B%0A%20%20%20%20)%2C%0A%20%20%20)%2C%0A%20%20)%0A%20)%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22pmroz_0-1655383151938.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22pmroz_0-1655383151938.png%22%20style%3D%22width%3A%20157px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22pmroz_0-1655383151938.png%22%20style%3D%22width%3A%20157px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F43316i334E11752A51E1EE%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22pmroz_0-1655383151938.png%22%20alt%3D%22pmroz_0-1655383151938.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-510547%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E8%A6%86%EF%BC%9A%E5%A6%82%E4%BD%95%E9%97%9C%E9%96%89%E3%80%8C%E6%96%B0%E8%A6%96%E7%AA%97%E3%80%8D%EF%BC%9F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-510547%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E5%B0%8D%E6%96%BC%E6%82%A8%E6%8F%90%E5%87%BA%E7%9A%84%E8%AA%9E%E6%B3%95%E5%95%8F%E9%A1%8C%EF%BC%8C%E6%82%A8%E5%8F%AF%E4%BB%A5%E5%9C%A8%E8%85%B3%E6%9C%AC%E7%B4%A2%E5%BC%95%E4%B8%AD%E6%89%BE%E5%88%B0%E7%AD%94%E6%A1%88%E3%80%82%3C%2FP%3E%0A%3CP%3E%E5%B9%AB%E5%8A%A9%3D%26gt%3B%E8%85%B3%E6%9C%AC%E7%B4%A2%E5%BC%95%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-510546%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E8%A6%86%EF%BC%9A%E5%A6%82%E4%BD%95%E9%97%9C%E9%96%89%E3%80%8C%E6%96%B0%E8%A6%96%E7%AA%97%E3%80%8D%EF%BC%9F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-510546%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%26lt%3B%26lt%3B%20%E9%97%9C%E9%96%89%E8%A6%96%E7%AA%97%EF%BC%9B%E6%88%96%20%26lt%3B%26lt%3B%20%E9%97%9C%E9%96%89%E8%A6%96%E7%AA%97()%3B%E6%87%89%E8%A9%B2%E7%AE%A1%E7%94%A8%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%0A%0Anw%20%3D%20New%20Window(%22%22)%3B%0Await(2)%3B%0Anw%20%26lt%3B%26lt%3B%20Close%20Window()%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
Andyon98
Level II

How do I close a “New window”?

I have been trying to close new windows but am successful, for arguments sake, I tried x = New Window( *some code*);

Close(x);
x << Close();
x << Close;
x << Close Window();


Any help would be greatly appreciated

2 ACCEPTED SOLUTIONS

Accepted Solutions
jthi
Super User

Re: How do I close a “New window”?

<< Close Window; or << Close Window(); should work

Names Default To Here(1);

nw = New Window("");
wait(2);
nw << Close Window();
-Jarmo

View solution in original post

pmroz
Super User

Re: How do I close a “New window”?

Here is a slightly more complicated example showing how to close a non-modal window with either the OK or Cancel buttons.

nw = new window("Test",
	textbox("Hello World"),
	panelbox("Actions",
		hlistbox(
			okb = button box("OK", << set icon("Go"),
				set script(
					show("Clicked OK");
					// Other OK actions here
					nw << close window();
				),
			),
			canb = button box("Cancel", << set icon("Stop"),
				set script(
					show("Clicked Cancel");
					nw << close window();
				),
			),
		)
	)
);

pmroz_0-1655383151938.png

 

View solution in original post

4 REPLIES 4
jthi
Super User

Re: How do I close a “New window”?

<< Close Window; or << Close Window(); should work

Names Default To Here(1);

nw = New Window("");
wait(2);
nw << Close Window();
-Jarmo
txnelson
Super User

Re: How do I close a “New window”?

For syntax questions such as you are asking, you can find your answers in the Scripting Index.

     Help=>Scripting Index

Jim
pmroz
Super User

Re: How do I close a “New window”?

Here is a slightly more complicated example showing how to close a non-modal window with either the OK or Cancel buttons.

nw = new window("Test",
	textbox("Hello World"),
	panelbox("Actions",
		hlistbox(
			okb = button box("OK", << set icon("Go"),
				set script(
					show("Clicked OK");
					// Other OK actions here
					nw << close window();
				),
			),
			canb = button box("Cancel", << set icon("Stop"),
				set script(
					show("Clicked Cancel");
					nw << close window();
				),
			),
		)
	)
);

pmroz_0-1655383151938.png

 

pmroz
Super User

Re: How do I close a “New window”?

Here's another wrinkle with regard to closing windows.  Let's say you have a dataset open and when the user clicks OK or Cancel there is an action to close the dataset.  But what if the user clicks the close window button (X in upper right)?  The on close() function takes care of it.  Here's an example:

// Build a display window for ftab_box
ftab_window = New Window("Frequency Tab", << on close(close(ftab_dataset, nosave)),
	H List Box(
		Button Box("Save to MSWord",
			ftab_output << Save MSWord("", Native);
		),
		Text Box( "   " ),
		Button Box( "Close this Window", 
					ftab_window << CloseWindow; 
//					close(ftab_dataset, nosave);	// This gets run by on close above
					),
	),
	ftab_output = vlistbox(
		outlinebox(ftab_title,
			ftab_box),
	),
);