Are you sure? Dialogue

Hi, I would like to prepare a really simple prompt where upon clicking a button to close a panel brings up a dialogue to say "Are you sure you wish to exit?" with two buttons saying yes / no or Continue / cancel, whatever really. This seems like it should be really simple but I can't find a way around needing to enter a numeric value/have a popup menu when going through the prompt/doprompt route. I hope for the procedure to look something like this:

 
Function ButtonExit(ctrlName) : ButtonControl
    string ctrlName

// code for dialogue
   
    if( V_flag == 0 )  
        DoWindow/K Panel0
        KillVariables/a/z
        KillWaves/a/z
    endif
End


Thanks, Tom
I think "DoAlert" is what you need.

DoAlert [/T=titleStr] alertType, promptStr
The DoAlert operation displays an alert dialog and waits for user to click a button.
Parameters
alertType = 0: Dialog with an OK button.
1: Dialog with Yes and No buttons.
2: Dialog with Yes, No, and Cancel buttons.
promptStr Text displayed in the alert dialog.
Flags
/T=titleStr Changes the title of the dialog window from the default title.
Details
DoAlert sets the special variable
V_flag = 1: Yes clicked.
2: No clicked.
3: Cancel clicked.



Thomas.Dane wrote:
Hi, I would like to prepare a really simple prompt where upon clicking a button to close a panel brings up a dialogue to say "Are you sure you wish to exit?" with two buttons saying yes / no or Continue / cancel, whatever really. This seems like it should be really simple but I can't find a way around needing to enter a numeric value/have a popup menu when going through the prompt/doprompt route. I hope for the procedure to look something like this:

 
Function ButtonExit(ctrlName) : ButtonControl
    string ctrlName

// code for dialogue
   
    if( V_flag == 0 )  
        DoWindow/K Panel0
        KillVariables/a/z
        KillWaves/a/z
    endif
End


Thanks, Tom



Yaohua Liu
Neutron & X-ray scattering/ Materials Science/ Argonne National Lab