Skip to main content
Participating Frequently
April 21, 2021
Question

How to handle Cancel button to return to a custom dialog from app.alter() choose?

  • April 21, 2021
  • 4 replies
  • 2487 views

I made a custom dialog and display it with execDialog() method. This custom dialog has a ok_cancel field. Now I want to let user to choose if he/she really want to exit from this custom dialog by prompt them a Yes_No app.alert dialog.
I already know how to handle some actions when Cancel button is called in that custom dialog, but I do not know how to stop exiting form custom dialog once Cancel action is triggered.

How may I achieve it?

 

Thanks in advance.

This topic has been closed for replies.

4 replies

JR Boulay
Community Expert
Community Expert
April 21, 2021

"Now, instead of doing nothing, I want to prompt user to confirm if they really want to close that dialog."

Technical response: Clicking any button means closing the current dialog box before doing anything else, so answer is: not possible.

 

User-friendly experience response: Are you serious?

😉

Acrobate du PDF, InDesigner et Photoshopographe
ls_rbls
Community Expert
Community Expert
April 21, 2021

As mentioned by try67, "not a simple task".

 

You may need to reference to the following tutorials by ACP Thom Parker (below) in order to customize your own alerts dialogue boxes with an option to collect responses from the user(s):

 

 

 

 

 

 

These tutorials will provide you with PDF examples that include some of the code that you may need which is available for download.

CrucifierAuthor
Participating Frequently
April 21, 2021

Thanks for your response.
Actually I have seen his tutorials before, they helped me a lot to achieve what I have already done.


I already call an app.alert() when I press Cancel (or Escape keyboard) in a Custom Dialog (I mean about dialogs discoused in last tutorial you provided, by adding a "cancel:function(dialog){}" function).
I already can get Yes or No response from the previously called app.alert().

The problem is I do not know how return to custom dialog once Cancel function is called.

ls_rbls
Community Expert
Community Expert
April 21, 2021

Ok, in that case share the script that you're currently using or an example of the PDF.

 

This will make it easier for us to assist you.

 

Seems like you may be missing a condition to handle that part.

JR Boulay
Community Expert
Community Expert
April 21, 2021

I'm not sure to really understand your needs, but I already made a custom dialog with YES and NO buttons, where NO is the default.

In this dialog NO (the default) means "do nothing" and YES means "Print".

Could this help you?

 

(NON = NO, OUI = YES)

 

Acrobate du PDF, InDesigner et Photoshopographe
CrucifierAuthor
Participating Frequently
April 21, 2021

Yes, I done something similar too. Now, instead of doing nothing, I want to prompt user to confirm if they really want to close that dialog.

try67
Community Expert
Community Expert
April 21, 2021

This is not possible, at least not if you use the built-in Cancel button.

In order to do it you would need to create your own "Cancel" button, attach a function to it and then close the dialog if the user clicks Yes in the alert window. However, doing so seems to be the same as clicking on OK, so you would need to use some kind of variable to differentiate between the two operations. In short, not a simple task...