Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsTreeViewer and TabFolder
https://www.eclipse.org/forums/index.php/mv/msg/147514/464359/#msg_464359
My TreeViewer works fine on my Composite (parent), but I want it to appear
within a TabItem. But TabItem isn't a Composite, so I created a second
Composite to hold the viewer. The TabFolder looks fine, but there's no
Tree.
Here's my code:
TabFolder folder = new TabFolder(parent, SWT.BOTTOM);
TabItem projectTab = new TabItem(folder, SWT.NONE, 0);
Composite projectComp = new Composite(folder, SWT.NONE);
TreeViewer treeViewer = new TreeViewer(projectComp);
...
projectTab.setControl(projectComp);
projectTab.setText("Project");
Any thoughts? Thanks.
Matt]]>Matt2005-11-22T03:05:33-00:00Re: TreeViewer and TabFolder
https://www.eclipse.org/forums/index.php/mv/msg/147514/464361/#msg_464361
are two ways of doing this, just putting in the tree, or making a function
for the composite (if you want more on the tab than the tree). The first
way of doing this would be something like:
TabFolder folder = new TabFolder(parent, SWT.BOTTOM);
TabItem projectTab = new TabItem(folder, SWT.NONE, 0);
projectTab.setControl(new TreeViewer(projectComp));
Note that this will only allow for the tree to be on the tab. If you
wanted more stuff on the tab you can still use a composite, and just pass
the composite to setControl like this:
TabFolder folder = new TabFolder(parent, SWT.BOTTOM);
TabItem projectTab = new TabItem(folder, SWT.NONE, 0);
// set up your composite here
Composite projectComp = new Composite(folder, SWT.NONE);
TreeViewer treeViewer = new TreeViewer(projectComp);
.....
// and anything else you want
// now pass the composite to setControl
projectTab.setControl(projectComp);
I think this is what you're looking for, but someone feel free to correct
me if I am wrong.
Aaron]]>Aaron2005-11-22T04:19:28-00:00Re: TreeViewer and TabFolder
https://www.eclipse.org/forums/index.php/mv/msg/147514/464364/#msg_464364
Thanks for the response! You're quite right about the importance of
setControl(), but there's a large difference between a Tree and a
TreeViewer.
setControl(new TreeViewer()) won't work because TreeViewers aren't
controls. But you can use:
treeName = new Tree(...);
new TreeViewer(treeName);
tabItem.setControl(treeName);
I'd forgotten that TreeViewers can be initialized with Trees as well as
with Composites. Your helpful reply jogged my memory, so I couldn't have
done it without you.
Thanks again.
Matt]]>Matt2005-11-22T05:53:06-00:00Re: TreeViewer and TabFolder
https://www.eclipse.org/forums/index.php/mv/msg/147514/464380/#msg_464380
TreeViewer regardless of how it was created. You do not need to create the
TreeViewer with a Tree.
e.g. :
TreeViewer tv = new TreeViewer(tabFolder);
TabItem item = new TabItem(tabFolder, SWT.NONE);
item.setControl(tv.getControl);
"Matt" <mattscar@yahoo.com> wrote in message
news:099cf4aa4f3b71004797b1cbf5b74cdf$1@www.eclipse.org...
> Aaron,
>
> Thanks for the response! You're quite right about the importance of
> setControl(), but there's a large difference between a Tree and a
> TreeViewer.
> setControl(new TreeViewer()) won't work because TreeViewers aren't
> controls. But you can use:
> treeName = new Tree(...);
> new TreeViewer(treeName);
> tabItem.setControl(treeName);
>
> I'd forgotten that TreeViewers can be initialized with Trees as well as
> with Composites. Your helpful reply jogged my memory, so I couldn't have
> done it without you.
>
> Thanks again.
>
> Matt
>
>
>
>
>]]>Veronika Irvine2005-11-22T13:54:02-00:00Re: TreeViewer and TabFolder
https://www.eclipse.org/forums/index.php/mv/msg/147514/464399/#msg_464399
used trees so I missed that part. Good to hear you got it though.