Answered
Public

Is there an existing way to set the background of the textfield to one color when the user is focused (focused meaning having the cursor visible) and a different one when it loses focus?

1 answer

Staff July 23, 2015

You can override “focused()” method to¬†change background. Find simple snippet that illustrates the idea¬†below:

var tf = new zebra.ui.TextField("abc", [
function focused() {
this.$super();
if (this.hasFocus()) {
this.setBackground("red");
} else {
this.setBackground("yellow");
}
}
]);
#1

Please login or Register to Submit Answer