|
Re: Table lines [message #503739 is a reply to message #503689] |
Tue, 15 December 2009 15:15 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
Hi Catalin,
No, the native Tables/Trees draw their lines like this, there isn't a way to
influence it. There are a couple of alternatives you can try though:
1. Put a Canvas on top of the Table where you don't want its lines to show,
like in the example snippet below (tried on Windows 2000). The problem in
this scenario occurs when the user resizes the columns, in which case you
have to adjust the Canvas' size in response.
public static void main(String[] args) {
final Display display = new Display();
Shell shell = new Shell(display);
shell.setBounds(200, 200, 400, 400);
shell.setLayout(new FillLayout());
Table table = new Table(shell, SWT.NONE);
table.setLinesVisible(true);
new TableColumn(table, SWT.NONE).setWidth(80);
new TableColumn(table, SWT.NONE).setWidth(80);
new TableColumn(table, SWT.NONE).setWidth(80);
new TableItem(table, SWT.NONE).setText(new String[]
{"one","two","three"});
Canvas canvas = new Canvas(table, SWT.NONE);
canvas.setBackground(table.getBackground());
shell.open();
Rectangle clientArea = table.getClientArea();
canvas.setBounds(240 + 1, 0, clientArea.width - 240 - 1,
clientArea.height);
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
shell.dispose();
display.dispose();
}
2. setLinesVisible(false) and then draw the lines yourself using custom
draw (
http://www.eclipse.org/articles/article.php?file=Article-Cus tomDrawingTableAndTreeItems/index.html )
.. The problem with this approach is that your lines will not look native
(each platform draws their lines differently, and are often influenced by
the user's theme).
HTH,
Grant
"Catalin Tileaga" <tileaga@gmail.com> wrote in message
news:hg7qe2$2ee$1@build.eclipse.org...
> I have a table with LinesVisible = true. The line goes after the last
column till the end of the table (for rows exactly the same). There is a
possibility to hide the line when no column (or row) exists? LinesVisible =
false is not a good solution for me.
>
> Thank you in advance,
> Catalin
|
|
|
|
Powered by
FUDForum. Page generated in 0.03833 seconds