cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-827874%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EBotones%20para%20cerrar%20el%20cuadro%20de%20di%C3%A1logo%20modal%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-827874%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3ESeg%C3%BAn%20tengo%20entendido%2C%20solo%20un%20m%C3%A1ximo%20de%20dos%20botones%20pueden%20cerrar%20un%20cuadro%20de%20di%C3%A1logo%20modal%3A%20%22Aceptar%22%20y%20%22Cancelar%22%20(u%20otros%20botones%20con%20nombres%20similares).%3C%2FP%3E%3CP%3ELo%20que%20me%20gustar%C3%ADa%20es%20tener%20otro%20bot%C3%B3n%20que%20haga%20algo%20(por%20ejemplo%2C%20establecer%20una%20variable)%20y%20luego%20cierre%20el%20cuadro%20de%20di%C3%A1logo%20como%20si%20hubiera%20presionado%20el%20bot%C3%B3n%20%22Aceptar%22.%20Algo%20como%20esto%3A%3C%2FP%3E%3CBR%20%2F%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(%201%20)%3B%0Aa%3D0%3B%0Anw%20%3D%20New%20Window(%20%22Demo%22%2C%0A%09%26lt%3B%3CMODAL%3E%3C%2FMODAL%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CCODE%20class%3D%22%20language-jsl%22%3EIs%20there%20any%20way%20of%20doing%20this%3F%20I%20tried%20including%20%22nw%20%26lt%3B%26lt%3B%20close%20window%22%20in%20the%20button%20script%20but%20that%20didn't%20work.%3C%2FCODE%3E%3C%2FP%3E%3CP%3E%3CCODE%20class%3D%22%20language-jsl%22%3EI%20could%20use%20a%20text%20edit%20box%2C%20or%20a%20check%20box%2C%20or%20many%20other%20options%20to%20set%20a%3D1%20before%20pressing%20%22OK%22%2C%20but%20all%20of%20those%20are%20additional%20clicks.%3C%2FCODE%3E%3C%2FP%3E%3CP%3E%3CCODE%20class%3D%22%20language-jsl%22%3EThanks!%3C%2FCODE%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%3CLINGO-LABS%20id%3D%22lingo-labs-827874%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EAutomatizaci%C3%B3n%20y%20scripting%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3C%2FCODE%3E%3CLINGO-SUB%20id%3D%22lingo-sub-827884%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Botones%20para%20cerrar%20el%20cuadro%20de%20di%C3%A1logo%20modal%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-827884%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EPuedes%20hacer%20que%20ese%20bot%C3%B3n%20presione%20el%20bot%C3%B3n%20Aceptar%20usando%20%26lt%3B%26lt%3B%20Clic%20(1)%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%0Aa%20%3D%200%3B%0Anw%20%3D%20New%20Window(%22Demo%22%2C%0A%09%26lt%3B%3CMODAL%3E%3C%2FMODAL%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-827885%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Botones%20para%20cerrar%20el%20cuadro%20de%20di%C3%A1logo%20modal%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-827885%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%C2%A1Muchas%20gracias%2C%20buena%20soluci%C3%B3n!%20No%20sab%C3%ADa%20que%20exist%C3%ADa%20Click()%2C%20una%20soluci%C3%B3n%20para%20recordar.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
matth1
Level IV

Buttons to close modal dialog

As I understand it, only a maximum of two buttons can close a modal dialog: "OK" and "Cancel" (or other similarly named buttons).

What I'd like is to have another button which does something (say, set a variable), then closes the dialog as if I'd pressed the "OK" button. Something like this:

 

Names Default To Here( 1 );
a=0;
nw = New Window( "Demo",
	<<modal,
	<<returnresult,
	Text Box( "A modal dialog" ),
	Button Box( "Do something different", a = 1 ), // I want this to close the dialog!
	H List Box( Button Box( "OK" ), Button Box( "Cancel" ) )
);
Show( nw, a );

Is there any way of doing this? I tried including "nw << close window" in the button script but that didn't work.

I could use a text edit box, or a check box, or many other options to set a=1 before pressing "OK", but all of those are additional clicks.

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Buttons to close modal dialog

You can make that button press OK button using << Click(1)

Names Default To Here(1);
a = 0;
nw = New Window("Demo",
	<<modal,
	<<returnresult,
	Text Box("A modal dialog"),
	Button Box("Do something different",
		a = 1;
		ok_btn << Click(1);
	), // I want this to close the dialog!
	H List Box(ok_btn = Button Box("OK"), Button Box("Cancel"))
);
Show(nw, a);
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Buttons to close modal dialog

You can make that button press OK button using << Click(1)

Names Default To Here(1);
a = 0;
nw = New Window("Demo",
	<<modal,
	<<returnresult,
	Text Box("A modal dialog"),
	Button Box("Do something different",
		a = 1;
		ok_btn << Click(1);
	), // I want this to close the dialog!
	H List Box(ok_btn = Button Box("OK"), Button Box("Cancel"))
);
Show(nw, a);
-Jarmo
matth1
Level IV

Re: Buttons to close modal dialog

Thank you, nice solution! I was unaware that Click() existed - one to remember.

Recommended Articles