Adding Text Stored in a Property
The example described in the section titled Authoring a Conditional "Please Wait . . . " Message Box displays a dialog box with text that reads: "Please wait while disk space costing is completed." This could be done simply by putting a Text Control on the dialog box and entering the text string into the Text column of the Control table. In this case, the information about the font style must be embedded in the string. The author must set the font and font style by prefixing the character string with {\style}. Where style is a font style identifier listed in the TextStyle column of the TextStyle table. This method of adding text is illustrated several times in An Installation Example.
An author of a user interface can also store text in a property. The following example illustrates this and shows how ControlEvents can be used to display alternative text strings.
The objective in this example is again to put up a WaitForCosting dialog box while a background task is running. The difference with the new scenario is that if the user cancels the WaitForCosting dialog box and then tries to activate the control before the background task has finished a second time, the WaitForCosting box reappears displaying an alternative message: "Disk space costing is still running. You can continue to wait or return to the main selection box to exit this sequence."
To display a "Please Wait" dialog box that displays alternative messages
- Begin by adding a conditional WaitForCosting dialog box to a Selection dialog box as described in Authoring a Conditional "Please Wait . . . " Message Box.
- Put a Text Control on the WaitForCosting dialog box by authoring a record in the Control table. Enter the identifier of the WaitForCosting dialog box into the Dialog_ column. Enter the identifier of the Text control into the Control column. Specify the type of control as Text in the Type column.
- Specify the Position control attribute for the text control by entering the horizontal and vertical coordinates of the control's upper left corner in the X and Y columns of the Control table. Use pixels as distance units.
- Specify the width and height of the text control by entering these dimensions into the Width and Height columns of the Control table. Use pixels as length units.
- The Property and Control_Next columns of the Control table do not affect Text controls and can be left blank in this case.
- Specify the control attributes for the Text control that are associated with bit flags. Add the individual bit values together and enter the total into the Attributes column of the Control table. These are the Visible, Sunken, Enabled, Transparent, NoWrap, and NoPrefix control attributes. The combination of bits that display a text control on an opaque background, with wrapping text is 0, therefore enter 0 or leave the Attributes column blank.
- The Text column of the Control table can be left blank. The Text control displays the text string that is the value of the Text control attribute. The method for setting this attribute is described in subsequent steps of this procedure.
- Add a record in the Property table to define the FirstMessage message property. This property is a string containing the font style and text for the first message. Enter the name FirstMessage in the Property column. In the Value column, enter the string: "{\WaitStyle}Please wait while disk space costing is completed." Where WaitStyle is an identifier for one of the font styles listed in the TextStyle column of the TextStyle table.
- Add a record in the Property table to define the SecondMessage message property. This property is a string containing the font style and text for the second message. Enter the name SecondMessage in the Property column. In the Value column enter the string: "{\WaitStyle}Disk space costing is still running. You can continue to wait or return to the main selection box to exit this sequence."
- Add a record in the Property table to define the WaitMessage message property. This property is a string containing the font style and text for the message displayed in the WaitForCosting dialog box if the user tries to activate a push button before costing is completed. Enter the name WaitMessage in the Property column. In the Value column of the Property table enter: FirstMessage.
- Add a SetProperty ControlEvent to the ControlEvent table that initializes WaitMessage to FirstMessage each time a New Selection dialog box opens. Enter the identifier for the dialog box that comes just before the Selection dialog in the dialog box sequence into the Dialog_ column. Enter the identifier for the control on this dialog box used to open the Selection dialog box into the Control_ column. Enter [WaitMessage] into the Event column. Enter [FirstMessage] into the Argument column. Enter 1 into the Condition column and leave the Ordering column blank.
- Add a SetProperty ControlEvent to the ControlEvent table that sets Waitmessage to SecondMessage if the user closes the WaitForCosting dialog box before disk space costing has completed. Enter the identifier for the WaitForCosting dialog box into the Dialog_ column. Enter the identifier for the Text control into the Control_ column. Enter [WaitMessage] into the Event column. Enter [SecondMessage] into the Argument column. Enter NOT CostingComplete into the Condition column and leave the Ordering column blank.
- The following step links the Text control attribute to the ControlEvent that spawns the WaitForCosting dialog box. This causes the installer to pass the value of the WaitMessage property to the Text control attribute each time the user opens a WaitForCosting dialog box.
- Subscribe the Text control attribute of the Text control to the SpawnWaitDialog ControlEvent that opens the WaitForCosting dialog box by adding a record to the EventMapping table. Enter the identifier for the WaitForCosting dialog box in the Dialog_ column. Enter the identifier for the Text control into the Control_ column. Enter SpawnWaitDialog into the Event column. Enter Text, the identifier for the Text control attribute, into the Attribute column of the EventMapping table.