How to get preferred size for a custom cell correctly? [message #1005736] |
Mon, 28 January 2013 08:24  |
Eclipse User |
|
|
|
For getting a preferred size of a cell - I am doing:
ILayerCell cell = natTable.getCellByPosition(colIndex, rowIndex);
ICellPainter cellPainter = natTable.getCellPainter(colIndex, rowIndex, cell, configRegistry);
int preferredColWidth = cellPainter.getPreferredWidth(cell, gc, configRegistry);
This returnes another values, than the values which I get, when doubleclicking the cell border.
How do I get the correct preferred cell width?
|
|
|
|
|
|
|
|
Re: How to get preferred size for a custom cell correctly? [message #1006068 is a reply to message #1006043] |
Tue, 29 January 2013 12:24  |
Eclipse User |
|
|
|
Thnx Dirk.
here is the code, which gets the visible rows:
/**
* @return the index of the first visible row
*/
private int getFirstVisibleRow() {
int firstRowIndex = viewportLayer.getRowPositionByIndex(0) * -1;
return firstRowIndex;
}
/**
* @return the index of the last visible row
*/
private int getLastVisibleRow() {
int firstVisibleRow = getFirstVisibleRow();
int lastVisibleRow = firstVisibleRow + viewportLayer.getRowCount() - 1;
return lastVisibleRow;
}
|
|
|
Powered by
FUDForum. Page generated in 0.30816 seconds