[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools] Re: inserting TreeItems in a tree
|
- From: evansac@xxxxxxxxxxx (Alun)
- Date: Thu, 17 Apr 2003 16:37:16 +0000 (UTC)
- Newsgroups: eclipse.tools
- Organization: http://www.eclipse.org
- User-agent: NewsPortal 0.23
Piyush,
You need the TreeItem constructor that takes a TreeItem as parent
and allows you to indicate the position (or index) of the new item,
where the first child of a parent is at index 0.
So, in your case you'd do something like this:
TreeItem newItem = new TreeItem(root, style, 1);
Cheers,
Alun
Piyush wrote:
> Hi All,
> Hope i'm posting the message to right group this time.
> I'm tryong to develop a small application using
> SWT(only).
> My problem is that i'm not able to find a way to
> insert TreeItem at a desired position in the Tree.
> Eg. My tree is of this form
> 0(root)
> -----1
> -------1.1 (1's child)
> -------1.2 (1's child)
> -----------1.2.1 (1.2's child)
> -----2(child of root)
> -------2.2
> -------2.3
> ......
> Now if i want to insert a tree item between 1 and 2
> i.e after 1.2.1 and as a child of root how should i go
> abt it. (Replacing of texts is not a good idea coz'
> i'll have to traverse the tree resursively to get the
> text of all treeitems).
> I don't want user to arrange the treeItems using drag
> and drop.
> Can anyone guide me how should i go about it. Is there
> any way to do this.
> Thanks in advance.
> Regards
> Piyush.