Chinaunix首页 | 论坛 | 博客
  • 博客访问: 588400
  • 博文数量: 208
  • 博客积分: 3286
  • 博客等级: 中校
  • 技术积分: 1780
  • 用 户 组: 普通用户
  • 注册时间: 2007-09-24 20:38
文章分类

全部博文(208)

文章存档

2012年(7)

2011年(28)

2010年(21)

2009年(76)

2008年(65)

2007年(11)

我的朋友

分类:

2009-03-27 18:27:47

 
PreviousNext
Help Library

AskOptions

InstallShield 2009 » InstallScript Language Reference

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 before calling AskOptions.

Note

Note

You cannot use the 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 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 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


InstallShield Help Library
5 June 2008

 

 

 

 

 

 

 

PreviousNext
Help Library


AskOptions Example

InstallShield 2009 » InstallScript Language Reference

Note

Note

To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release.

/*-----------------------------------------------------------*\

*

* InstallShield Example Script

*

* Demonstrates the AskOptions function.

*

* The AskOptions dialog is displayed twice. First, it is

* displayed with check boxes; then it is displayed with option

* buttons.  The example shows the maximum number of options

* allowed--nine.

*

\*----------------------------------------------------------*/

// Include Ifx.h for built-in InstallScript function prototypes.

#include "Ifx.h"

export prototype ExFn_AskOptions(HWND);

function ExFn_AskOptions(hMSI)

    STRING szMsg, szText1, szText2, szText3, szText4, szText5;

    STRING szText6, szText7, szText8, szText9;

    NUMBER nReturn, nValue,  nvCheck1, nvCheck2, nvCheck3, nvCheck4;

    NUMBER nvCheck5, nvCheck6, nvCheck7, nvCheck8, nvCheck9;

begin

    szMsg = "Select from the options below.";

    szText1 = "Option 1";

    szText2 = "Option 2";

    szText3 = "Option 3";

    szText4 = "Option 4";

    szText5 = "Option 5";

    szText6 = "Option 6";

    szText7 = "Option 7";

    szText8 = "Option 8";

    szText9 = "Option 9";

    nvCheck1 = TRUE;

    nvCheck2 = FALSE;

    nvCheck3 = FALSE;

    nvCheck4 = FALSE;

    nvCheck5 = FALSE;

    nvCheck6 = FALSE;

    nvCheck7 = FALSE;

    nvCheck8 = FALSE;

    nvCheck9 = FALSE;

    // Display the check box (NONEXCLUSIVE) dialog.

    nValue = NONEXCLUSIVE;

    AskOptions (nValue, szMsg,

               szText1, nvCheck1,

               szText2, nvCheck2,

               szText3, nvCheck3,

               szText4, nvCheck4,

               szText5, nvCheck5,

               szText6, nvCheck6,

               szText7, nvCheck7,

               szText8, nvCheck8,

               szText9, nvCheck9);

    // Display the option button (EXCLUSIVE) dialog.

    nValue = EXCLUSIVE;

    AskOptions (nValue, szMsg,

               szText1, nvCheck1,

               szText2, nvCheck2,

               szText3, nvCheck3,

               szText4, nvCheck4,

               szText5, nvCheck5,

               szText6, nvCheck6,

               szText7, nvCheck7,

               szText8, nvCheck8,

               szText9, nvCheck9);

end;


InstallShield Help Library
5 June 2008
 | 

 | 
阅读(1094) | 评论(0) | 转发(0) |
0

上一篇:AskDestPath

下一篇:AskPath

给主人留下些什么吧!~~