API Reference 0.3.24dart_web_toolkit_uiTextBoxImpl

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() #

Creates a new Object instance.

Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.

docs inherited from Object
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
 }
}