Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » changing text of tree items
changing text of tree items [message #1450890] Thu, 23 October 2014 03:16 Go to next message
charlie schindler is currently offline charlie schindlerFriend
Messages: 26
Registered: June 2014
Junior Member
i have a handler class which needs to set text of the tree items in the GUI.
the tree is like
> expandable treeitem
- treeitem 1
- treeitem 2

i want to change the text of "expandable treeItem", "treeitem 1", ....

this seems not to work:

TreeItem clusterItem = selectedForm.getTreeWidget().getTopItem();
clusterItem.setText("gaga");

the clusterItem is set, but not changed

selectedForm is an instanceOf dialog, the GUI i want to change the text.

The tree widget is exposed so i can access it from my handler class

see attachments

what do i do wrong?

[Updated on: Mon, 27 October 2014 04:32]

Report message to a moderator

Re: changing text of tree items [message #1455268 is a reply to message #1450890] Wed, 29 October 2014 07:29 Go to previous messageGo to next message
Niraj Modi is currently offline Niraj ModiFriend
Messages: 47
Registered: November 2013
Member
Suggest you to refer below Tree Snippet which modify text of the TreeItem at runtime (double click on a TreeItem to get into editor mode)
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet111.java

Tried adding below line at line 66 & line 88 in above "Snippet111" and it works fine:
tree.getTopItem().setText("Test");
Re: changing text of tree items [message #1455355 is a reply to message #1455268] Wed, 29 October 2014 09:26 Go to previous message
charlie schindler is currently offline charlie schindlerFriend
Messages: 26
Registered: June 2014
Junior Member
thx, studied it already
did not reflect my case, where i do need to change the text, from another class.
solved it though for initial display by calling the display after changing.
not sure yet if this will work changing stuff after the dialog is displayed already.
Previous Topic:tree item selected set focus on another widget
Next Topic:How do I contribute to SWT?
Goto Forum:
  


Current Time: Thu Oct 18 17:35:54 GMT 2018

Powered by FUDForum. Page generated in 0.02247 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top