Element el = getElement(); int index = el.getElementIndex(pos);
int index = -1; for (int i = 0; i < children.length; i++) { if (children[i].getStartOffset() >= pos && children[i].getEndOffset() < pos) { index = i; break; } }
  protected int getViewIndexAtPosition(int pos)  {    // We have one child view allocated for each child element in    // loadChildren(), so this should work.    Element el = getElement();    int index = el.getElementIndex(pos);    return index;  }