Deprecated. The UI service was deprecated on December 11, 2014. To create user interfaces, use the HTML service instead.
A text box that shows a
when the user focuses on it.
DatePicker
Here is an example of how to use this widget:
function doGet() { var app = UiApp.createApplication(); var handler = app.createServerHandler("change"); var dateBox = app.createDateBox().addValueChangeHandler(handler).setId("datebox"); app.add(dateBox); return app; } function change(eventInfo) { var app = UiApp.getActiveApplication(); app.add(app.createLabel("The value of the date box changed to " + eventInfo.parameter.datebox)); return app; }
Internally, UiApp widgets are built on top of the Google Web Toolkit, and it can sometimes be helpful to look at the GWT documentation directly. You can find the DateBox documentation here.
Deprecated methods
Method | Return type | Brief description |
---|---|---|
|
| Sets the dependent style name of this . |
|
| Adds a style name to this . |
|
| Add a handler for value change events. |
| String | Returns the id that has been assigned to this object. |
| String | Gets the text tag of this . |
| String | Gets the type of this object. |
|
| Hide the date picker. |
|
| Sets the widget's 'access key'. |
|
| Sets whether the is enabled. |
|
| Sets whether value changed events are fired for invalid or empty input in the box. |
|
| Explicitly focus/unfocus this . |
|
| Sets the format used to control formatting and parsing of dates in this . |
|
| Sets the height of this . |
|
| Sets the id of this . |
|
| Set the layout for this . |
|
| Sets the name of the , which is how it will be referred to when used in a
FormPanel or as a callback element on an event handler. |
|
| Sets the size of this in pixels. |
|
| Sets the size of this . |
|
| Sets one of this 's style attributes to a new value. |
|
| Sets this 's style attributes. |
|
| Sets the style name of this . |
|
| Sets the primary style name of this . |
|
| Sets the 's position in the tab index. |
|
| Sets the text tag of this . |
|
| Sets the hover title of this . |
|
| Sets the date shown by this . |
|
| Sets whether this is visible. |
|
| Sets the width of this . |
|
| Parses the current 's value and shows that date. |
Deprecated methods
addStyleDependentName(styleName)
addStyleDependentName(styleName)
Deprecated. This function is deprecated and should not be used in new scripts.
Sets the dependent style name of this
.
DateBox
This is useful for debugging but is otherwise of minimal use since there is no way to use custom stylesheets in UiApp.
Parameters
Name | Type | Description |
---|---|---|
styleName | String | the new style name. |
Return
addStyleName(styleName)
addStyleName(styleName)
Deprecated. This function is deprecated and should not be used in new scripts.
Adds a style name to this
.
DateBox
This is useful for debugging but is otherwise of minimal use since there is no way to use custom stylesheets in UiApp.
Parameters
Name | Type | Description |
---|---|---|
styleName | String | the new style name. |
Return
addValueChangeHandler(handler)
addValueChangeHandler(handler)
Deprecated. This function is deprecated and should not be used in new scripts.
Add a handler for value change events.
Note that you can have multiple handlers for the same event on the same widget. They will be
called in the order that they were added to the widget, although
s may appear to happen
simultaneously.
ServerHandler
The handler passes back some information to the server about what happened. This information can be accessed as follows:
function doGet() { var app = UiApp.createApplication(); var textBox = app.createTextBox(); var handler = app.createServerHandler("handlerFunction"); textBox.addValueChangeHandler(handler); app.add(textBox); return app; } function handlerFunction(eventInfo) { var parameter = eventInfo.parameter; // the type of event, in this case "valueChange". var eventType = parameter.eventType; // the id of the widget that fired this event. var source = parameter.source; }In addition, the values of certain widgets can be sent up with the event as well as "callback elements." See the documentation of
ServerHandler
for more information.Parameters
Name | Type | Description |
---|---|---|
handler |
| the handler to execute when the event occurs. This can be a or a . |
Return
getId()
getId()
Deprecated. This function is deprecated and should not be used in new scripts.
Returns the id that has been assigned to this object.
This can be used in conjunction with app.getElementById() to retrieve a reference to this object.
Return
String
— the id that has been assigned to this object
getTag()
getTag()
Deprecated. This function is deprecated and should not be used in new scripts.
Gets the text tag of this
.DateBox
Return
String
— the text tag.
getType()
getType()
Deprecated. This function is deprecated and should not be used in new scripts.
Gets the type of this object.
Return
String
— the object type
hideDatePicker()
hideDatePicker()
setAccessKey(accessKey)
setAccessKey(accessKey)
Deprecated. This function is deprecated and should not be used in new scripts.
Sets the widget's 'access key'. This key is used (in conjunction with a browser-specific modifier key) to automatically focus the widget.
Parameters
Name | Type | Description |
---|---|---|
accessKey | Char | the character to use for focus |
Return
setEnabled(enabled)
setEnabled(enabled)
setFireEventsForInvalid(fireEvents)
setFireEventsForInvalid(fireEvents)
Deprecated. This function is deprecated and should not be used in new scripts.
Sets whether value changed events are fired for invalid or empty input in the box.
If this is false, which is the default, value change events will only be fired for valid dates selected from the picker or typed into the box. If this is true, a value change event will be fired when the box is changed from a valid date string to an invalid or empty string, with the date value in the event set to null. No value change event will be fired if the box is changed from one invalid string to another, since all invalid or empty dates are equivalently treated as null dates.
Parameters
Name | Type | Description |
---|---|---|
fireEvents | Boolean | if set to true, value change events will be fired when the box is changed from a valid date string to an invalid or empty string, with the date value in the event set to null. |
Return
setFocus(focus)
setFocus(focus)
Deprecated. This function is deprecated and should not be used in new scripts.
Explicitly focus/unfocus this
.
DateBox
Only one widget can have focus at a time, and the widget that does will receive all keyboard events.
Parameters
Name | Type | Description |
---|---|---|
focus | Boolean | whether the should have the current focus. |
Return
setFormat(dateTimeFormat)
setFormat(dateTimeFormat)
Deprecated. This function is deprecated and should not be used in new scripts.
Sets the format used to control formatting and parsing of dates in this
.
DateBox
If this
is not empty, the contents will be replaced with current
contents in the new format.DateBox
Parameters
Name | Type | Description |
---|---|---|
dateTimeFormat |
| the desired format such as UiApp.DateTimeFormat.DATE_TIME_FULL. |
Return
setHeight(height)
setHeight(height)
setId(id)
setId(id)
setLayoutData(layout)
setLayoutData(layout)
setName(name)
setName(name)
Deprecated. This function is deprecated and should not be used in new scripts.
Sets the name of the
, which is how it will be referred to when used in a
FormPanel or as a callback element on an event handler.DateBox
Parameters
Name | Type | Description |
---|---|---|
name | String | the new name. |
Return
setPixelSize(width, height)
setPixelSize(width, height)
setSize(width, height)
setSize(width, height)
Deprecated. This function is deprecated and should not be used in new scripts.
Sets the size of this
.DateBox
Parameters
Name | Type | Description |
---|---|---|
width | String | the new width in any CSS unit such as "10px" or "50%". |
height | String | the new height in any CSS unit such as "10px" or "50%". |
Return
setStyleAttribute(attribute, value)
setStyleAttribute(attribute, value)
Deprecated. This function is deprecated and should not be used in new scripts.
Sets one of this
's style attributes to a new value. Valid attributes are listed here; the values for each attribute are the
same as those available in CSS style sheets.
DateBox
// Change the widget's background to black and text color to green. widget.setStyleAttribute("background", "black") .setStyleAttribute("color", "green");
Parameters
Name | Type | Description |
---|---|---|
attribute | String | the CSS attribute, in camel-case ("fontSize", not "font-size"), as listed here |
value | String | the CSS value |
Return
setStyleAttributes(attributes)
setStyleAttributes(attributes)
Deprecated. This function is deprecated and should not be used in new scripts.
Sets this
's style attributes. This is a convenience method that is equivalent
to calling setStyleAttribute with every key/value pair in the attributes object. Valid
attributes are listed here; the values for each
attribute are the same as those available in CSS style sheets.
DateBox
// Change the widget's background to black and text color to green. widget.setStyleAttributes({background: "black", color: "green"});
Parameters
Name | Type | Description |
---|---|---|
attributes | Object | an object of key/value pairs for the CSS attributes and values to set; valid attributes are listed here |
Return
setStyleName(styleName)
setStyleName(styleName)
Deprecated. This function is deprecated and should not be used in new scripts.
Sets the style name of this
.
DateBox
This is useful for debugging but is otherwise of minimal use since there is no way to use custom stylesheets in UiApp.
Parameters
Name | Type | Description |
---|---|---|
styleName | String | the new style name. |
Return
setStylePrimaryName(styleName)
setStylePrimaryName(styleName)
Deprecated. This function is deprecated and should not be used in new scripts.
Sets the primary style name of this
.
DateBox
This is useful for debugging but is otherwise of minimal use since there is no way to use custom stylesheets in UiApp.
Parameters
Name | Type | Description |
---|---|---|
styleName | String | the new style name. |
Return
setTabIndex(index)
setTabIndex(index)
Deprecated. This function is deprecated and should not be used in new scripts.
Sets the
's position in the tab index.
DateBox
If more than one widget has the same tab index, each such widget will receive focus in an arbitrary order. Setting the tab index to -1 will cause this widget to be removed from the tab order.
Parameters
Name | Type | Description |
---|---|---|
index | Integer | the new tab index. |
Return
setTag(tag)
setTag(tag)
setTitle(title)
setTitle(title)
setValue(date)
setValue(date)
setVisible(visible)
setVisible(visible)
setWidth(width)
setWidth(width)