Found a couple of hacky solutions to this so maybe someone with a bit more time could expand on this.
Solution 1) In the de.kupzog.ktable.KTable.java file, in the function:
protected void drawCells(GC gc, Rectangle clipRect, int fromCol, int toCol, int fromRow, int toRow)
Remove the line (line 1038 in my version):
fromCol = valid.x;
This tries to squeeze the contents of the spanned column into the available space and also has problems with the right side border of the squeezed column.
2) slightly better results again in the same function we change it to the following:
protected void drawCells(GC gc, Rectangle clipRect, int fromCol, int toCol, int fromRow, int toRow) {
Rectangle r;
// for the starting col and row, we have to check if they
// are subcells that are part of a span cell.
Point valid = getValidCell(fromCol, fromRow);
int diffCol = fromCol - valid.x;
fromCol = valid.x;
if (valid.y<fromRow)
fromRow = valid.y;
int moveLeft = 1;
for (int i=Math.min(fromCol+m_ColumnsVisible, toCol);
i>fromCol; i-=moveLeft) {
valid = getValidCell(i, fromRow);
if (valid.y<fromRow)
fromRow = valid.y;
moveLeft = i-valid.x+1;
}
if (m_CellEditor != null) {
if (!isCellVisible(m_CellEditor.m_Col, m_CellEditor.m_Row)) {
Rectangle hide = new Rectangle(-101, -101, 100, 100);
m_CellEditor.setBounds(hide);
} else {
m_CellEditor.setBounds(getCellRect(m_CellEditor.m_Col,
m_CellEditor.m_Row));
}
}
This doesn't squeeze the content of the column and the border draws properly.
Note: the testing of this has been extremely limited (basically only for fixed cols spanning 2 cols with a single underneath) but this might give you a starting point.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
screenshot
Logged In: NO
I have the same problem.
Logged In: NO
The aceptable solution is to use ScrolledComposite instead
of KTable scrolling.
Found a couple of hacky solutions to this so maybe someone with a bit more time could expand on this.
Solution 1) In the de.kupzog.ktable.KTable.java file, in the function:
protected void drawCells(GC gc, Rectangle clipRect, int fromCol, int toCol, int fromRow, int toRow)
Remove the line (line 1038 in my version):
fromCol = valid.x;
This tries to squeeze the contents of the spanned column into the available space and also has problems with the right side border of the squeezed column.
2) slightly better results again in the same function we change it to the following:
protected void drawCells(GC gc, Rectangle clipRect, int fromCol, int toCol, int fromRow, int toRow) {
Rectangle r;
// for the starting col and row, we have to check if they
// are subcells that are part of a span cell.
Point valid = getValidCell(fromCol, fromRow);
int diffCol = fromCol - valid.x;
fromCol = valid.x;
if (valid.y<fromRow)
fromRow = valid.y;
int moveLeft = 1;
for (int i=Math.min(fromCol+m_ColumnsVisible, toCol);
i>fromCol; i-=moveLeft) {
valid = getValidCell(i, fromRow);
if (valid.y<fromRow)
fromRow = valid.y;
moveLeft = i-valid.x+1;
}
if (m_CellEditor != null) {
if (!isCellVisible(m_CellEditor.m_Col, m_CellEditor.m_Row)) {
Rectangle hide = new Rectangle(-101, -101, 100, 100);
m_CellEditor.setBounds(hide);
} else {
m_CellEditor.setBounds(getCellRect(m_CellEditor.m_Col,
m_CellEditor.m_Row));
}
}
int fromCol_X = 0;
if(diffCol > 0){
int hidespace = 0;
for(int i=fromCol;i<(fromCol + diffCol);i++){
hidespace += getCellRectIgnoreSpan(i, fromRow).width;
}
fromCol_X += clipRect.x - hidespace;
}else{
fromCol_X = getCellRectIgnoreSpan(fromCol, fromRow).x;
}
for (int row = fromRow; row < toRow; row++) {
Note the new lines:
int diffCol = fromCol - valid.x;
and
int fromCol_X = 0;
if(diffCol > 0){
int hidespace = 0;
for(int i=fromCol;i<(fromCol + diffCol);i++){
hidespace += getCellRectIgnoreSpan(i, fromRow).width;
}
fromCol_X += clipRect.x - hidespace;
}else{
fromCol_X = getCellRectIgnoreSpan(fromCol, fromRow).x;
}
This doesn't squeeze the content of the column and the border draws properly.
Note: the testing of this has been extremely limited (basically only for fixed cols spanning 2 cols with a single underneath) but this might give you a starting point.