TextBoxImpl class
Implementation class used by {@link com.google.gwt.user.client.ui.TextBox}.
class TextBoxImpl {
factory TextBoxImpl.browserDependent() {
return new TextBoxImpl();
}
TextBoxImpl();
int getCursorPos(dart_html.InputElement elem) {
// Guard needed for FireFox.
try{
return elem.selectionStart;
} catch (e) {
return 0;
}
}
int getSelectionLength(dart_html.InputElement elem) {
// Guard needed for FireFox.
try{
return elem.selectionEnd - elem.selectionStart;
} catch (e) {
return 0;
}
}
int getTextAreaCursorPos(dart_html.InputElement elem) {
return getCursorPos(elem);
}
int getTextAreaSelectionLength(dart_html.InputElement elem) {
return getSelectionLength(elem);
}
void setSelectionRange(dart_html.InputElement elem, int pos, int length) {
try {
elem.setSelectionRange(pos, pos + length);
} catch (e) {
// Firefox throws exception if TextBox is not visible, even if attached
}
}
}
Constructors
new TextBoxImpl() #
factory TextBoxImpl.browserDependent() #
factory TextBoxImpl.browserDependent() {
return new TextBoxImpl();
}
Methods
int getCursorPos(InputElement elem) #
int getCursorPos(dart_html.InputElement elem) {
// Guard needed for FireFox.
try{
return elem.selectionStart;
} catch (e) {
return 0;
}
}
int getSelectionLength(InputElement elem) #
int getSelectionLength(dart_html.InputElement elem) {
// Guard needed for FireFox.
try{
return elem.selectionEnd - elem.selectionStart;
} catch (e) {
return 0;
}
}
int getTextAreaCursorPos(InputElement elem) #
int getTextAreaCursorPos(dart_html.InputElement elem) {
return getCursorPos(elem);
}
int getTextAreaSelectionLength(InputElement elem) #
int getTextAreaSelectionLength(dart_html.InputElement elem) {
return getSelectionLength(elem);
}
void setSelectionRange(InputElement elem, int pos, int length) #
void setSelectionRange(dart_html.InputElement elem, int pos, int length) {
try {
elem.setSelectionRange(pos, pos + length);
} catch (e) {
// Firefox throws exception if TextBox is not visible, even if attached
}
}