跳到主要内容

SetLabel

Sets label to button widget field.

Syntax

expression.SetLabel(sLabel, sApType);

expression - A variable that represents a ApiButtonWidget class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sLabelRequiredstringbutton label
sApTypeOptionalButtonAppearance'normal'for what state is the label set

Returns

boolean

Example

This example sets button widget labels.

let doc = Api.GetDocument();
let page = doc.GetPage(0);
let buttonField = Api.CreateImageField([10, 10, 120, 100]);
page.AddObject(buttonField);

let widgets = buttonField.GetAllWidgets();
widgets[0].SetLayout('iconTextV');
widgets[0].SetBehavior('push');

widgets[0].SetLabel('Normal label', 'normal');
widgets[0].SetLabel('Down label', 'down');
widgets[0].SetLabel('Hover label', 'hover');