PDA

View Full Version : GridView ensureVisible misses cell width



bhomass
17 Oct 2009, 5:00 PM
ensureVisible calculates where to set scroll to ensure focused cell is visible. it miscalculates x by the cell width.

I fixed it by subclassing GridView.focusCell()


public void focusCell(int rowIndex, int colIndex, boolean hscroll) {
super.focusCell(rowIndex, colIndex, hscroll);
Point xy = ensureVisible(rowIndex, colIndex, hscroll);
if (xy != null) {
xy.x += cm.getColumn(colIndex).getWidth();
focusEl.setXY(xy);
}
}