FeatureAddItem

InstallShield 2014 » InstallScript Language Reference

Project: This information applies to the following project types:

InstallScript
InstallScript MSI

The FeatureAddItem function adds a feature to a script-created feature set. If a script-created feature set with the name specified by szFeatureSet does not already exist, this function creates it.

Call FeatureAddItem once for each feature you want to add to a given script-created feature set. You can create multiple script-created feature sets, each with a unique name (szFeatureSet parameter).

Caution: This function cannot be used with file media libraries.

Syntax

FeatureAddItem ( szFeatureSet, szFeature, nDataSize, bSelected );

Parameters

FeatureAddItem Parameters

Parameter

Description

szFeatureSet

Specifies the name of the script-created feature set to which an item will be added. If the script-created feature set does not exist, FeatureAddItem creates it.

szFeature

Specifies the name of the feature to be added. Do not use a null string (""). To learn how to refer to top-level features and subfeatures, see Specifying Features and Subfeatures in Function Calls.

nDataSize

Specifies the size in bytes of the data the feature represents. If the feature is a series of files, this parameter specifies the total uncompressed size of all the files.

bSelected

Specifies the default selection setting of the feature. Pass one of the following predefined constants in this parameter:

TRUE—Indicates that the feature is selected by default. If TRUE is passed to select a subfeature whose parent feature is not selected, the subfeature is not selected—despite passing TRUE in the bSelected parameter.
FALSE—Indicates that the feature is not selected by default.

Note: Default selection settings are cleared when the user selects a feature or subfeature displayed in a dialog. If the user clears a selected feature, all of its subfeatures are cleared. If the user clears all of a feature's subfeatures, the feature's selection setting is cleared.

Return Values

FeatureAddItem Return Values

Return Value

Description

0

FeatureAddItem successfully added the item to the feature or subfeature to the script-created feature set.

< 0

FeatureAddItem was unable to add the item to the feature or subfeature to the script-created feature set. For additional information, call FeatureError.

Additional Information

To display a single level of features to the end user for selection, use FeatureDialog, SdFeatureDialog, or SdFeatureDialogAdv.
To display features and their subfeatures, use SdFeatureDialog2, SdFeatureMult, or SdFeatureTree.
You can use FeatureAddItem and script-created feature sets to allow users to select from options other than file media feature options:
1. Call FeatureAddItem to create a script-created feature set containing the options you want.
2. To display those options for selection, call SdAskOptions or SdAskOptionsList with the script-created feature set name in the parameter szFeature.
3. To determine which options were selected, call FeatureIsItemSelected.

See Also