|treeviewer selects first item in tree on open [message #491278]
||Tue, 13 October 2009 22:40
| Natasha D'Silva
Registered: July 2009
I have a View that uses a sashform with a treeviewer/textviewer as its control.|
The treeviewer has columns, and I notice that when the view is activated, the first item in the view is selected. If I click anywhere in the treeviewer, even in an empty row, the first item is still selected.
Debugging has shown that just clicking anywhere in the treeviewer generates a selection event. I have looked at other eclipse views with a treeviewer with columns and this does not happen. I am wondering if there is a special style bit I am missing on my tree.
Does it matter when I populate the viewer with model elements by calling setInput for the first time?
Here is the code to create the view:
fSashForm = new SashForm(parent, SWT.VERTICAL);
TreeViewer viewer = new TreeViewer(fSashForm, SWT.FULL_SELECTION | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
// TreeViewer viewer = new TreeViewer(parent, SWT.FULL_SELECTION | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.HIDE_SELECTION | SWT.BORDER);
TableLayout layout = new TableLayout();
ColumnLayoutData c0Data = new ColumnWeightData(20);
ColumnLayoutData c1Data = new ColumnWeightData(30);
ColumnLayoutData c2Data = new ColumnWeightData(50);
fDetailText = new TextViewer(fSashForm, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
fDetailText.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
Experimenting with SWT.HIDE_SELECTION did not work, which is expected since its supposed to be for tables only.
Any help/tips would be appreciated,
Powered by FUDForum
. Page generated in 0.02619 seconds