All installers have Cancel buttons on each dialog page. There are no general switches and no black magic either as to how these are implemented; they use standard installer actions. This topic explains how.
Each dialog box with a Cancel button has an event handler for that button's OnClicked event; see the screen shot below.

This event handler does two things:
This logic is present for each dialog box with a Cancel button; to restore it in case you accidentally deleted it, just create a new CancelBtn:OnClicked event handler (right-click on the Cancel button, then choose New Event Handler... and follow the prompts) and add the two actions shown above.
Please note that the EndDialog action in each event handler must close the current dialog (OptionsDlg in the screen shot above).
There is also a variable called UIAllowCancel defined on the Symbolic Variables project page. This variable is used to determine whether or not cancellation of the installation is allowed once is has started.
By default, only the predefined ProgressDlg dialog box uses this variable. In that dialog box, UIAllowCancel is used to enable or disable the Cancel button using the push button control's Condition field; see the screen shot below.
Tip: You can use a similar method to selectively enable or disable other dialog boxes or controls.
