Multiple "OK" Buttons in Modal WindowIs 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></MODAL>
Re: Multiple "OK" Buttons in Modal WindowMark:
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!
Re: Multiple "OK" Buttons in Modal WindowI 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.
Re: Multiple "OK" Buttons in Modal WindowI'd also like this. The OK-ness of a button should be related to a property of the button other than the button title.
Re: Multiple "OK" Buttons in Modal WindowHere 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" );
Re: Multiple "OK" Buttons in Modal WindowHi 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
Re: Multiple "OK" Buttons in Modal Window<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />MS, thanks for pointing this out. We do look for different names for the buttons. Generally this is just to handle the OK/Cancel and Yes/No variants, but yes, they can be used at the same time.
Re: Multiple "OK" Buttons in Modal WindowMaybe just a curiosity, but it is possible to have two working "OK" buttons as long as one is a "YES" button.
In the modal window generatet by the code below, pressing the first "OK" or the "YES" both return {Button( 1 )} whereas the second "OK" is inactive.
New Window( "New Window",
<<MODAL></MODAL>
Re: Multiple "OK" Buttons in Modal WindowNo, there is currently no way to avoid the addition of the OK button in this case. This is done to guarantee that the window can be dismissed.
Re: Multiple "OK" Buttons in Modal WindowHey guys,
Another wrinkle to this question: is there a way to have a modal dialog box without the OK or Cancel buttons?
nw = new window("Test Modal", << modal(),
panelbox("Actions",
hlistbox(
a = button box("Close A",
print("Closing with A");
a << close window;
),
b = button box("Close B",
print("Closing with B");
b << close window;
)
)
)
);
Re: Multiple "OK" Buttons in Modal WindowThanks Dan!
Re: Multiple "OK" Buttons in Modal WindowIt looks like Eric's solution works in (soon-to-be-released) JMP 12, but JMP 11 has a different behavior.
One problem in the original script is that w1 cannot be used until the New Window call completes, and in the case of a Modal window the call does not complete until the window is dismissed! And because the window is gone by the time the call returns, the return value from a Modal call to New Window is not a window reference at all. Instead it is {Button(1)} if OK was pressed and {Button(-1)} if Cancel was pressed.
Fortunately, you can send a <
w1 = New Window( "New Window",
<<MODAL></MODAL>
Note that the behavior for the added button is closer to 'Cancel' than 'OK' - the return value w1 will be {Button(-1)} for the "Other OK" button and the On Validate() script [if it exists] will not be run. That's ok - you can simply do your own validation within the button script, but keep this in mind if looking at the return value from New Window().
Re: Multiple "OK" Buttons in Modal WindowHi Eric,
Thank you for the response. When I run your script,
Current Window() << Close Window;
closes the Script window, not the message box. Are you doing anything special to make it work?
Re: Multiple "OK" Buttons in Modal WindowTry Current Window() instead of trying to refer to w1. This worked for me:
w1 = New Window( "New Window",
<<MODAL></MODAL>