cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
robot
Level VI

Multiple "OK" Buttons in Modal Window

Is it possible to design a modal window with multiple "OK" choices?  I think my main difficulty is closing the window after selection of the second OK button.  Is there a more clever way to do this?  I am using JMP11.  Example is below.

 

Thanks!

 

 

 

w1 = New Window( "New Window",
  <<Modal,
  // Get user input,
  H List Box(
  Button Box( "OK",
  // Proceed with option 1
  ),
  Button Box( "Other OK",
  w1 << Close Window; // I can not get this to work.
  // Proceed with option 2
  ),
  Button Box( "Cancel", Throw( "Script cancelled by user." ) )
  )
);

 

13 REPLIES 13
SamH
Level III

Re: Multiple "OK" Buttons in Modal Window

Hi Guys, I am new to this. if you want a window to prompt the user for two options only

1) Ok, then the script after that will continue on doing whatever needs to be done.

2) Cancel, if this option is selected, I want to stop/exit the script or go to end of the script.

 

Thanks

Sam

txnelson
Super User

Re: Multiple "OK" Buttons in Modal Window

Here is an example of what you would need to do

Names Default To Here( 1 );
nw = New Window( "test",
	modal,
	Text Box( "Click OK if you want to continue" ),
	H List Box( Button Box( "OK" ), Button Box( "Cancel" ) )
);
If( nw["button"] == -1,
	Throw()
);
Show( "Continuing processing" );
Jim

Re: Multiple "OK" Buttons in Modal Window

I question the need for more than one OK or Cancel button in any dialog. These controls and their associated actions have special meaning. These two buttons are meant to be the only ways to dismiss the dialog. User interface design principles generally avoid duplicating controls, especially standard controls.

The example that you started with could use another control to determine the desired option before dismissing the dialog. It looks like a radio box would be appropriate in this situation.

You want to use separate controls for separate and distinct purposes.

Judah
Level II

Re: Multiple "OK" Buttons in Modal Window

Mark:

Your response reminds me of what my freshman-level programming professor said to the class about this.  It was something to the effect of, "Don't intentionally confuse the user.  For example, don't have a Cancel button perform [delete *.*]."  I got a chuckle back then...and now!