grid coordinates fix

This commit is contained in:
Vadim Lopatin 2014-06-09 14:40:20 +04:00
parent ee8c6edbd7
commit f2311006b5
1 changed files with 7 additions and 6 deletions

View File

@ -1115,13 +1115,13 @@ class StringGridWidget : StringGridWidgetBase {
} }
/// get cell text /// get cell text
override dstring cellText(int col, int row) { override dstring cellText(int col, int row) {
if (col >= 0 && col < _cols && row >= 0 && row < _rows) if (col >= 0 && col < cols && row >= 0 && row < rows)
return _data[row][col]; return _data[row][col];
return ""d; return ""d;
} }
/// set cell text /// set cell text
override StringGridWidgetBase setCellText(int col, int row, dstring text) { override StringGridWidgetBase setCellText(int col, int row, dstring text) {
if (col >= 0 && col < _cols && row >= 0 && row < _rows) if (col >= 0 && col < cols && row >= 0 && row < rows)
_data[row][col] = text; _data[row][col] = text;
return this; return this;
} }
@ -1148,11 +1148,11 @@ class StringGridWidget : StringGridWidgetBase {
int oldcols = cols; int oldcols = cols;
int oldrows = rows; int oldrows = rows;
super.resize(c, r); super.resize(c, r);
_data.length = _rows; _data.length = r;
for (int y = 0; y < r; y++) for (int y = 0; y < r; y++)
_data[y].length = _cols; _data[y].length = c;
_colTitles.length = _cols; _colTitles.length = c;
_rowTitles.length = _rows; _rowTitles.length = r;
} }
/// returns row header title /// returns row header title
@ -1177,6 +1177,7 @@ class StringGridWidget : StringGridWidgetBase {
} }
protected override Point measureCell(int x, int y) { protected override Point measureCell(int x, int y) {
//Log.d("measureCell ", x, ", ", y);
FontRef fnt = font; FontRef fnt = font;
dstring txt = cellText(x, y); dstring txt = cellText(x, y);
Point sz = fnt.textSize(txt); Point sz = fnt.textSize(txt);