跳到主要内容

GetOption

Gets option from list options.

Syntax

expression.GetOption(nPos);

expression - A variable that represents a ApiComboboxField class.

Parameters

NameRequired/OptionalData typeDefaultDescription
nPosRequirednumberoption index to get

Returns

ListOption

Example

This example gets option from field with list of options.

let doc = Api.GetDocument();
let page = doc.GetPage(0);
let comboboxField = Api.CreateComboboxField([10, 10, 160, 30]);
page.AddObject(comboboxField);

comboboxField.AddOption('Option 1');
let option = comboboxField.GetOption(0);
comboboxField.SetValue('First options is: ' + option);