如何获取/使用 2 个小部件的名称并在函数中使用它们?

How to get / use the name of 2 widgets and use them in a function?

我正在尝试设置一个函数来隐藏 Button1 并使 Button2可见。

到目前为止,我可以隐藏 Button1,因为我在脚本部分编写了以下代码:

function nextButton(Button1) {
     Button1.visible = false;
}

我在 Button1 的 OnClick 事件中写道:

nextButton(widget);

我想做的是将 Button2 发送到函数。我尝试了以下方法:

OnClick event: nextButton2(widget, Button2);
Script:  function nextButton(Button1, Button2) {
     Button1.visible = false;
     Button2.visible = true;  }

这样当我点击 Button1 时它会隐藏而 Button2 会出现。 但是发送对象的名称(Button2)好像不行。

你知道我如何引用另一个对象并将其发送到函数吗?

您应该从全局变量 app 中获取 Button2 元素。

var Button2 = app.pages.PageWithTheButton.Button2; //Assuming the button is directly in the page.