How do you know if a non-modal dialog was canceled?

Got a problem you cannot solve? Try here.
Post Reply
jsmith
Posts: 178
Joined: Tue Nov 04, 2008 10:47 am

How do you know if a non-modal dialog was canceled?

Post by jsmith »

How can you tell if a non-modal dialog was canceled? The "Return Result in Variable" field of Display Dialog is only applicable to modal dialogs. What about non-modal dialogs?

I've tried checking the value of the built-in ABORT variable after hiding the dialog, but it never hits that code:

Code: Select all

Display Dialog: progress, use as progress dialog (non-modal)

Apply Install (get result into variable SUCCESS)
if Variable SUCCESS not Equals ERROR
  Call DLL Function $TARGETDIR$\\CustomActions.dll->Install (get result into variable CUSTACTSUCCESS)

  if Variable CUSTACTSUCCESS not Equals 0
    Set Variable SUCCESS to ERROR
    Set Variable LASTERROR to Post-Install Actions Failed
    Apply Uninstall
  end
end

Hide Dialog
if Variable ABORT Equals TRUE
  MessageBox: $TITLE$ Setup, User Canceled!  Abort = true!
else
  MessageBox: $TITLE$ Setup, Abort != true
end

Neither of the message boxes are ever displayed. I do see a "Setup canceled" message box, but I believe this is coming from within IA. I am not explicitly displaying this.

How do I capture that a user pressed cancel on a non-modal dialog so that I can perform cleanup and exit cleanly?

Thanks!
using InstallAware 9 R2 (Build Moya.sp3.070910)
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

The Pre-Defined Variables topic in help describes some helpful variables, read up on: ABORT, ABORTONERROR, ABORTEDONERROR - some of these are new for InstallAware 9 and provide enhanced error handling facilities in your MSIcode script.

Also, Apply Changes returns CANCEL when installation has been aborted.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
jsmith
Posts: 178
Joined: Tue Nov 04, 2008 10:47 am

Post by jsmith »

Thanks Michael. Setting ABORTONERROR to FALSE allows me to clean up when the user cancels.
using InstallAware 9 R2 (Build Moya.sp3.070910)
Post Reply