Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to set a treeitem background or foreground(How to set a treeitem background or foreground)
How to set a treeitem background or foreground [message #778905] Sat, 14 January 2012 04:23 Go to next message
Le Le is currently offline Le LeFriend
Messages: 2
Registered: January 2012
Junior Member
Hi there,

How to set a treeitem background or foreground based on a menuitem clicked?

e.g. I have a treeitem called Project and right click Project it has two menu items, one is Activate, and one is Deactivate. When Activate clicked, I would like to have the Project background and foreground color set to different ones, when Deactivate clicked, the colors will return to original ones.

Is there a way to do it? I am stuck for two days already..

Thanks for your help and time!

Lele

Re: How to set a treeitem background or foreground [message #779804 is a reply to message #778905] Mon, 16 January 2012 15:36 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Listen on the MenuItem for a Selection event, example:
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet131.java
..

Then change the Table/Tree item's color, example:
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet129.java
.. This snippet is for TableItems, but doing it for TreeItems is identical.

Grant


On 1/13/2012 11:23 PM, Le Le wrote:
> Hi there,
>
> How to set a treeitem background or foreground based on a menuitem clicked?
>
> e.g. I have a treeitem called Project and right click Project it has two
> menu items, one is Activate, and one is Deactivate. When Activate
> clicked, I would like to have the Project background and foreground
> color set to different ones, when Deactivate clicked, the colors will
> return to original ones.
>
> Is there a way to do it? I am stuck for two days already..
>
> Thanks for your help and time!
>
> Lele
>
>
Re: How to set a treeitem background or foreground [message #779939 is a reply to message #779804] Mon, 16 January 2012 21:27 Go to previous message
Le Le is currently offline Le LeFriend
Messages: 2
Registered: January 2012
Junior Member
Thank you very much, it worked.
Previous Topic:Splashscreen not shown and Targetplatform
Next Topic:Master Detail Block-Retain Section state
Goto Forum:
  


Current Time: Thu Sep 19 10:01:26 GMT 2024

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

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

Back to the top