How to add a Print or Open button to a dialog box

This document explains how to add a Print or Open PushButton control to Tarma native installer dialog boxes. The Print or Open buttons can be added to any dialog box that contains a RichText control, including the predefined ReadmeDlg and LicenseDlg dialog boxes.

MSI Note Windows Installer does not support this functionality.

Recommended procedure

The recommended procedure to add a Print or Open PushButton control is as follows.

  1. Right-click anywhere in the dialog box and choose New Control > PushButton from the popup menu.
  2. Use the mouse to move the newly created control into the desired position. You can make finer adjustments with the keyboard: the arrow keys move the control, while Shift+arrow keys resize the control.
  3. Set the PushButton control attributes as follows:
  4. Right-click on the new control, then choose New Event Handler... from the popup menu.
  5. In the Select Dialog Event dialog box that appears, select the new control under Event source (it should be preselected already), then select OnClicked in the Available events list. Then click Select.
  6. The Event handlers tab is now visible and the newly added event handler (called PrintButton:OnClicked or OpenButton:OnClicked, or something similar) is selected.
  7. Right-click on the event handler, then choose New Action > Set Window State from the popup menu.
  8. Set the Set Window State attributes as follows:
  9. Rebuild your project.

What happens when the user clicks the Print or Open button during installation is that the RichText control saves its contents to a temporary RTF disk file, then uses the Windows Shell to open or print the text with the appropriate application. The default application for RTF files is WordPad, which is included with all Windows releases. However, if another word processor is installed, it will typically be the word processor that takes over the RTF file handling and takes care of the opening or printing.