问题
I currently have a Table [org.eclipse.swt.widgets.Table] with several TableColumns; however, due to UI space restrictions I have a bit of an issue.
Lets say for example I had a table column named "Target User" and this couldn't be named anything else AND the whole display "Target User" had to be displayed. Now lets say I also have several other Table Columns with the same problems.
I was hoping I could add a new line or do something to set the height of the column so it could be Target \n User and I could save some width that way. However, \n does not seem to work in org.eclipse.swt.widgets.TableColumn.setText , nor does html.
Any ideas?
回答1:
Apparently, this (the "\n
" within a Label
of a TableColumn
) only works in Linux, not Windows.
See bug 97077 (2005!)
Linux/GTK implementation of table column can be easily made multiline inserting "
\n
" into text - should work in current implementations.
Windows implementation for this would be very tricky. In Win32 programming people either replace table control or table header control to get this functionality or create all kind of tricks to full ListView32 window to allow multiliner.
来源:https://stackoverflow.com/questions/1359295/swt-setting-column-height-or-insert-new-line