|Image size cannot be changed after first setImage in SWT Table using Win32 [message #461130]
||Fri, 16 September 2005 16:57
Registered: July 2009
We wanted to make a table look like Excel. We put an image in the first |
column with a row number drawn into it.
This all worked great until we resized the column. What we found was that
no matter what, any image we tried to set was the same width as the
I posted here and was roundly scolded with something like "SWT is not
Excel so stop trying to make it so."
Frustrated that I could not get help here, I turned to one of the authors
of what many would agree is the best book on SWT and JFace
This person, studied the problem and confirmed it:
"I played with this awhile, and it appears, as far as I can tell, that
youve run into a bugone that appears to be on the Windows side,
actually, although I havent had a chance to test on Linux or Mac OS X.
When you call TableItem.setImage(), it calls TableItem.redraw(), which
then calls TableItem.getBounds() to determine the area in which to draw.
TableItem.getBounds sends the Windows message LVM_GETSUBITEMRECT to the
Table, which is actually a Windows ListView control. The resulting RECT
returned always contains the original width, at least on my machine. So,
your code thinks the image is one size (the column width), but when SWT
sizes the image to draw it in the table cell it always draws it with the
Short on time and having misplaced my bugzilla name/password, could
someone help out by advising if this has already been reported or should
Even if it is a Windows problem that SWT cannot overcome (like the first
column always being left justified), wouldn't it make sense to log the bug
Powered by FUDForum
. Page generated in 0.02425 seconds