Community
Participate
Working Groups
M8 See the following example and note that the second table (with the fonts set) has ellipis even when there is plenty of space. /** * @since 3.0 */ public class TableItemTest { public static void main(String [] argv) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Table t = new Table(shell, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); TableItem i = new TableItem(t, SWT.NONE); i.setText("Good table item 1"); i = new TableItem(t, SWT.NONE); i.setText("Good table item 2"); i = new TableItem(t, SWT.NONE); i.setText("Good table item 3"); Font f = new Font(shell.getDisplay(), "Courier New", 8, SWT.NORMAL); t = new Table(shell, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); i = new TableItem(t, SWT.NONE); i.setText("Bad table item 1"); i.setFont(f); i = new TableItem(t, SWT.NONE); i.setText("Bad table item 2"); i.setFont(f); i = new TableItem(t, SWT.NONE); i.setText("Bad table item 3"); i.setFont(f); shell.pack(); shell.open(); shell.redraw(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }
Created attachment 9007 [details] Doesn't happen for me
Created attachment 9008 [details] What I get There is what I get, both before and after resizing the window.
Do you have any ideas? What theme are you using?
I'm running the XP Silver theme with slightly modified font sizes - my window title font is set a bit larger. I've tried reverting to the default theme and I still see the same results. Michael suggested it might be an issue with my video card(s)/drivers(s).
If you modify the code to set the font on the "good table" items to Display.getSystemFont() they render correctly. Also, if you set the 'bad font" font on the "bad table" (not the items) then the ellipsis do not appear.
I also found something else... not sure if it's a symptom of the same problem or not. If you set the font on a cel item to be something very large (20pt, for instance) then the cel items draw over one another and are not sufficiently large to contain the text. However, if you set it on the table itself then the cels are sized properly (both vertically and horizontally).
Created attachment 9029 [details] Table.setFont() vs TabileItem.setFont()
The problem is that the Windows table does not really support different fonts in table items very well. What it provides is the ability to draw an item using a different font. Needless to say, it doesn't know to use the font that you are going to draw with to do the measuring necessary to show scroll bars. We could possible hack Table.setScrollWidth() to measure the right font. Strangely, it does't seem to fail on my machine no matter what font I choose. Could something else be going on?
What version of XP are you running? I'm running XP Professional 2002 SP 1... I've managed to find a workaround for my particular case. Whenever I'm going to set a font on the item I check to see how wide the item string is when rendered in that font. If it's larger than my last known largest value I set that font on the table as well as the item. It's ugly but it'll work until this gets sorted.
*** Bug 68164 has been marked as a duplicate of this bug. ***
The Table widget was changed so that it measures each string rather than using LVSCW_AUTOSIZE. This was done for performance. As a side effect, I think it may have fixed this bug. I can not make the problem happen for me. Kim, does the problem still happen for you?
I havn't noticed it in some time, now that you mention it.
Closing as Fixed. Resolved some time late 2004 as a side effect of another bug fix. Please reopen if you see this again.