Hello,
if i have a html-table like
----------------------------------------------
<TABLE width=100% >
<TR bgcolor=grey>
<TD width=120px>Column1 120px</TD>
<TD width=120px>Column2 120px</TD>
<TD width=120px>Column3 120px</TD>
<TD>Column4</TD>
</TR>
</TABLE>
----------------------------------------------
all the columns (and not only the last) are resized if the widget ist
smaller then it should be.
To fix this i patched htmltable.c:
...
/* Allocate pixels to explicit width columns */
#if 20110615
for (ii = 0; ii < pData->nCol; ii++) {
if (aReqWidth[ii].eType == CELL_WIDTH_PIXELS) {
int iReq = MAX(0, aReqWidth[ii].x.iVal - aWidth[ii]);
aWidth[ii] += iReq;
iRemaining -= iReq;
}
}
#else
if (iRemaining > 0) {
for (ii = 0; ii < pData->nCol; ii++) {
if (aReqWidth[ii].eType == CELL_WIDTH_PIXELS) {
int iReq = MAX(0, aReqWidth[ii].x.iVal - aWidth[ii]);
aWidth[ii] += iReq;
iRemaining -= iReq;
}
}
}
#endif
...
assert(CELL_WIDTH_AUTO == 0);
assert(CELL_WIDTH_PIXELS == 1);
assert(CELL_WIDTH_PERCENT == 2);
for (jj = 0; iRemaining < 0 && jj < 3; jj++) {
#if 20110615
/*
------------------------------------------------------------ *
* Only reduce columns with CELL_WIDTH_AUTO or
CELL_WIDTH_PERCENT
*
------------------------------------------------------------ */
if (jj != CELL_WIDTH_AUTO || jj != CELL_WIDTH_PERCENT )
{
continue;
};
#endif
....
Here some tcl-Code to test:
--------------------------------------------------------------------------- ----
package require Tkhtml
html .h
grid .h -sticky nesw
grid columnconfigure . 0 -weight 1
grid rowconfigure . 0 -weight 1
set data "
<HTML>
<BODY >
<TABLE width=100% >
<TR bgcolor=grey>
<TD width=120px>Column1 120px</TD>
<TD width=120px>Column2 120px</TD>
<TD width=120px>Column3 120px</TD>
<TD >Column4</TD>
</TR>
</TABLE>
</BODY></HTML>
"
.h parse -final $data
--------------------------------------------------------------------------- ----
And then resize the html-widget.
Shall i commit this fix to htmltable.c? Where? How?
Matthias