AskOptions

InstallShield 2015 » InstallScript Language Reference

Project: This information applies to the following project types:

InstallScript
InstallScript MSI

The AskOptions function formats and displays a dialog that prompts the end user to select one or more options. The dialog displays up to nine selection controls—either check boxes or option buttons—depending on the value of nValue.

The default title for this dialog is Select Features. To change the contents of the title bar, call SetDialogTitle before calling AskOptions.

Note: You cannot use the PlaceWindow function in conjunction with the AskOptions function. By default, the dialog appears in the center of the desktop, unless the background window mode is enabled. If the installation is in window mode, the dialog appears in the center of the background window.

Syntax

AskOptions ( nValue, szMsg, szText1, bvCheck1, szText2, bvCheck2[, szTextn, bvCheckn] [,..., ...] );

Parameters

AskOptions Parameters

Parameter

Description

nValue

Specifies the type of controls to display. Pass one of the following predefined constants in this parameter:

EXCLUSIVE—Specifies option buttons, which enable the end user to select only one option.
NONEXCLUSIVE—Specifies check boxes, which enable the end user to select more than one option.

szMsg

Specifies the message to display in the dialog. You can use this message to describe the options and/or ask the user to choose one or more options. If the message is too long for one line, use newline escape sequences ( \n ) to insert line breaks.

Note: Your operating system dictates the maximum message string length.By default, the display of szMsg text is limited to two lines by the AskOptions dialog resource in _Isres.dll. To display more than two lines of szMsg text, you can create a custom dialog from the AskOptions dialog.

szText1

Specifies a text label to display next to the first check box or option button. The maximum number of characters that can be displayed depends on the font you use; be sure to check that the string specified fits in the static text field of the dialog. If the string does not fit, either shorten it or call SdAskOptions instead.

To create an accelerator key, insert an ampersand (&) before the character you want to designate for that purpose. The character is displayed with an underline to indicate its function. For example, to make Alt + C the accelerator key for Custom, pass "&Custom"; to make Alt + S the accelerator key for Custom, pass "Cu&stom."

bvCheck1

Specifies the initial status of the first check box or option button when the dialog is opened; returns the status of the first check box or option button when the dialog is closed. The following constants are passed and returned in this parameter:

TRUE—The first check box or option button is selected.
FALSE—The first check box or option button is not selected.

szText2

Specifies a text label to display next to the second check box or option button. The maximum number of characters that can be displayed depends on the font you use; be sure to check that the string specified fits in the static text field of the dialog. If the string does not fit, either shorten it or call SdAskOptions instead.

Create an accelerator in the same manner as you did for szText1.

bvCheck2

Specifies the initial status of the second check box or option button when the dialog is opened; returns the status of the second check box or option button when the dialog is closed. The following constants are passed and returned in this parameter:

TRUE—The first check box or option button is selected.
FALSE—The first check box or option button is not selected.

Up to seven additional options can be defined. Each additional option is indicated by a pair of parameters—a string parameter that defines a label and a number variable that indicates the state of the option when AskOptions returns. To set the initial state of an option, assign TRUE or FALSE to the number variable before calling AskOptions.

Note: If nValue is EXCLUSIVE and the initial state of more than one option is set to TRUE, AskOptions preselects the first option in the parameter list that is set to TRUE.

Return Values

AskOptions Return Values

Return Value

Description

NEXT (1)

Indicates that the end user clicked the Next button. The states of the controls are returned in the individual bvCheck variables.

BACK (12)

Indicates that the end user clicked the Back button. The states of the controls are returned in the individual bvCheck variables.

Additional Information

To view an example of this or other dialogs for your installation, use the Dialog Sampler. In InstallShield, on the Tools menu, point to InstallScript, then click Standard Dialog Sampler or Skinned Dialog Sampler.

See Also