Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT 3.1.1 Tree TreeItem background color columns treetable
SWT 3.1.1 Tree TreeItem background color columns treetable [message #462107] Thu, 06 October 2005 13:55 Go to next message
James Cornett is currently offline James CornettFriend
Messages: 3
Registered: July 2009
Junior Member
I am building a tree table using the new Tree functionality. When setting
the background on a TreeItem using SWT 3.1.1, only the item background color
in the Tree is set. The rest of the columns are not. In SWT 3.1.0, the
entire row background color was set.

The reason I need this to work is I have a recursive routine that alternates
row color, much like the behaviour of tables in GTK when showGrid is true.
I am using Windows, which of course shows a grid instead of alternating
colors. I call the routine after the tree is populated and when items are
expanded or collapsed.

Any answers to this problem are appretiated.

If anyone is interested, here is a snippet from my custom viewer:

int ri;

public void stripeRows(final TreeItem[] items)
{
ri = 0;
Display.getDefault().asyncExec(new Runnable() {

public void run()
{
traverseAndColor(items);
}

});
}

private void traverseAndColor(TreeItem[] items)
{
for (int i = 0; i < items.length; i++) {
TreeItem item = items[i];
if (ri % 2 == 0) {
item.setBackground(evenColor);
setControlsBackground(item, evenColor);
}
else {
item.setBackground(oddColor);
setControlsBackground(item, oddColor);
}
ri++;
if (item.getExpanded())
traverseAndColor(item.getItems());
}
}

private void setControlsBackground(TreeItem item, Color color)
{
if (item.getData() != null && item.getData() instanceof Control[]) {
Control[] controls = (Control[]) item.getData();
for (Control control : controls)
if (control != null) {
control.setBackground(color);
}
}
}
Re: SWT 3.1.1 Tree TreeItem background color columns treetable [message #462122 is a reply to message #462107] Thu, 06 October 2005 19:54 Go to previous message
Billy Biggs is currently offline Billy BiggsFriend
Messages: 94
Registered: July 2009
Member
James Cornett wrote:
> I am building a tree table using the new Tree functionality. When setting
> the background on a TreeItem using SWT 3.1.1, only the item background color
> in the Tree is set. The rest of the columns are not. In SWT 3.1.0, the
> entire row background color was set.

Sorry this became broken, I have filed this bug and the problem will
be fixed in the next maintenance release:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=111836

-Billy
Previous Topic:Appending to Text from non-UI thread
Next Topic:Retreive the html code from Browser widget
Goto Forum:
  


Current Time: Wed Sep 23 23:52:33 GMT 2020

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

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

Back to the top