Deprecated. The UI service was deprecated on December 11, 2014. To create user interfaces, use the HTML service instead.
Create user interfaces for use inside Google Apps or as standalone services.
Deprecated properties
Property | Type | Description |
---|---|---|
DateTimeFormat |
| Constants to use with setFormat methods in UiApp widgets such as
and . |
FileType |
| Constants to use with UiApp.createGoogleDocsPicker();
and . |
HorizontalAlignment |
| Constants to use with setHorizontalAlignment methods in UiApp. |
VerticalAlignment |
| Constants to use with setVerticalAlignment methods in UiApp. |
Deprecated methods
Method | Return type | Brief description |
---|---|---|
|
| Create a new UiInstance, which you can use to build a UI. |
|
| Gets the active UiInstance. |
| String | Return the browser user-agent string, so that you can tailor your app as needed. |
Deprecated methods
createApplication()
createApplication()
Deprecated. This function is deprecated and should not be used in new scripts.
Create a new UiInstance, which you can use to build a UI.
Use this in the entry point of your app to create a UI. For example:
function doGet(e) {
var app = UiApp.createApplication();
// Create a button tied to a server click handler.
app.add(app.createButton('Click me!', app.createServerHandler('onClick')).setId('button'));
// Create a button tied to a client click handler.
app.add(app.createButton('Click me too!',
app.createClientHandler().forEventSource().setText('Clicked!')));
return app; // If you don't return the UiInstance, the change won't happen
}
function onClick(e) {
var app = UiApp.getActiveApplication();
app.getElementById('button').setText('Clicked!');
return app;
}
Note that you cannot return a new UiInstance in an event handler from an existing UiInstance.
Return
— a new UiInstance.UiInstance
getActiveApplication()
getActiveApplication()
Deprecated. This function is deprecated and should not be used in new scripts.
Gets the active UiInstance.
Use this in the context of an event handler to interact with the existing UI. For example:
function doGet(e) {
var app = UiApp.createApplication();
app.add(app.createButton('Click me!', app.createServerHandler('onClick')).setId('button'));
return app;
}
function onClick(e) {
var app = UiApp.getActiveApplication();
app.getElementById('button').setText('Clicked!');
return app; // If you don't return the UiInstance, the change won't happen
}
Return
— the active UiInstance.UiInstance
getUserAgent()
getUserAgent()
Deprecated. This function is deprecated and should not be used in new scripts.
Return the browser user-agent string, so that you can tailor your app as needed.
Return
String
— the user-agent string.