Hi, I am trying to write a modal that uses non standard text for the buttons. That is, according to the documentation one button with the text OK, Yes, No, or Cancel is required as a way to close the modal. In this case I have a couple of modals where instead of "OK" I have "Continue" and instead of "Cancel" I have "Not now". I see that according to the documentation you can do something like:
acknowledgeButton = Button Box( acknowledgeText, acknowledgeButton << Close Window ),
In order to use a button with a different text to close the modal. The problem is that the resulting behavior is a bit strange. Specifically, when clicked, the button disappears, but there is a delay before the modal is dismissed so for about half a second you are still seeing the modal, just without the button. Is there something that I can do to get the standard "OK"/"Cancel" behavior where the modal is immediately dismissed on click?
Full code for my modal:
Names Default To Here( 1 );
simpleMessageModal = Function( {title, message, acknowledgeText},
{Default Local},
result = Associative Array();
modal = New Window( title,
<<Modal,
Border Box( Left( MODAL_PADDING ), Right( MODAL_PADDING ),
V List Box(
Spacer Box( size( MODAL_WIDTH, SECTION_START_SPACING ) ),
H Center Box( Text Box( message ) ),
Spacer Box( size( MODAL_WIDTH, SECTION_END_SPACING ) ),
),
),
H List Box(
Spacer Box(),
acknowledgeButton = Button Box( acknowledgeText, acknowledgeButton << Close Window ),
// Modals require at least one button with the text "OK", "Yes", "No", and will insert
// one if there is no such button present, so we insert one and make it invisible.
Button Box( "OK", <<Visibility( "collapse" ) ),
),
);
confirmed = modal != {Button( -1 )};
Return( confirmed );
);
Edit: more context info:
MacOS 13.3.1, 32 GB RAM
2.6 GHz 6-Core Intel Core i7
JMP 17