谷歌应用程序脚本UI如何将消息插入VerticalPanel()?

时间:2013-11-01 12:54:38

标签: user-interface google-apps-script google-sheets

我正在尝试编写这个简单的UI,它应该显示带有两个参数的消息(name,email2send)。但是,当我运行它时,我只得到这个:

enter image description here

变量msg的内容未显示在面板中,只显示在面板标题中。这样做的正确方法是什么?

// Show confirmation 
 function showMSG(name, email2Send) { // for ease of use I give the urls as parameters but you could define these urls in the function as well
  var app = UiApp.createApplication().setHeight(60).setWidth(200);
  app.setTitle("Msg send with sucess!");  
  var msg = "You request to " + email2Send + " a response from " + name;
  app.add(app.createVerticalPanel().setTag(msg));
  var doc = SpreadsheetApp.getActive();
  doc.show(app);
  }

感谢您的任何帮助!

1 个答案:

答案 0 :(得分:1)

窗口小部件的TAG不可见,其目的实际上是以不可见的方式存储字符串数据。 要显示文字,请使用labelhtml小部件。

代码中的

示例:

function showMSG(name, email2Send) { // for ease of use I give the urls as parameters but you could define these urls in the function as well
  var app = UiApp.createApplication().setHeight(60).setWidth(200);
  app.setTitle("Msg send with sucess!");  
  var msg = "You request to " + email2Send + " a response from " + name;
  app.add(app.createVerticalPanel().add(app.createLabel(msg)));
  var doc = SpreadsheetApp.getActive();
  doc.show(app);
  }