Methods Google应用程序脚本-通过my class方法创建的处理程序
请帮忙。我尝试编写自己的类,例如:Methods Google应用程序脚本-通过my class方法创建的处理程序,methods,google-apps-script,handler,Methods,Google Apps Script,Handler,请帮忙。我尝试编写自己的类,例如: function doGet() { var app = UiApp.createApplication(); var o = new myClass.o('Name'); var i = o.show() app.add(i); return app; } //Class function o(name){ this.app = UiApp.getActiveApplication(); this.name = na
function doGet() {
var app = UiApp.createApplication();
var o = new myClass.o('Name');
var i = o.show()
app.add(i);
return app;
}
//Class
function o(name){
this.app = UiApp.getActiveApplication();
this.name = name
}
o.prototype.show = function() {
var app = this.app;
var myPlace = this.createPlace();
var myForm = this.createForm();
var myBar = this.createBar();
myForm.setWidget(0,0, myBar);
myPlace.setWidget(0,0, myForm);
return myPlace
};
o.prototype.createPlace = function() {
var app = this.app
var id = this.name+'_'+'myPlace';
var place = app.createGrid(1,1)
.setId(id)
.setStyleAttribute('margin', '0px')
.setCellSpacing(0)
.setCellPadding(0)
.setBorderWidth(0);
return place
};
o.prototype.createForm = function() {
var app = this.app
var id = this.name+'_'+'myForm';
var form = app.createGrid(4,1)
.setId(id)
.setStyleAttribute('margin', '0px')
.setCellSpacing(0)
.setCellPadding(0)
.setBorderWidth(0);
return form
};
o.prototype.createBar = function() {
var app = this.app;
var id = this.name+'_'+'Bar';
var bar = app.createGrid(1,10)
.setId(id)
.setStyleAttribute('margin', '0px')
.setCellSpacing(0)
.setCellPadding(0)
.setBorderWidth(0);
var button = this.createButtonRefresh()
bar.setWidget(0,0,button)
return bar
};
o.prototype.createButtonRefresh = function() {
var app = this.app;
var handler = app.createServerHandler('???????????');
var myPlace = app.getElementById(this.name+'_'+'myPlace')
handler.addCallbackElement(myPlace)
var id = this.name+'_'+'btRefresh';
var button = app.createButton('Refresh')
.setId(id)
.setFocus(true)
.addClickHandler(handler);
return button
};
o.prototype.navEvent = function (){
Logger.log('Joooo')
}
所有这些都是有效的,只有在有“??”的地方我有个问题。在那里,我需要一个事件。我尝试了许多组合调用,但仍然报告它找不到函数。当然,作为处理程序的普通函数可以工作,但我想要一个自定义类方法。如果可以设置对象自身类的按钮处理程序方法,请告诉我的用户。如果可以,怎么做
我提前感谢您的帮助。在这种情况下,什么是气体?-当然不是GNU汇编程序。