Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » ToolBar/ToolItem background colour on TabItems
icon5.gif  ToolBar/ToolItem background colour on TabItems [message #529371] Sat, 24 April 2010 04:43 Go to next message
Karsten Stöckmann is currently offline Karsten Stöckmann
Messages: 12
Registered: July 2009
Junior Member
Hi,

recently, I came across some (perhaps) weird colouring problem when creating a ToolBar on a TabItem. Consider the following snippet:

package snippets;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;


public final class TabItemSnippet {

  private final Display display = new Display();
  private final Shell shell = new Shell(display);
  

  public static void main(String[] args) {

    new TabItemSnippet();
    
  }
  
  
  public TabItemSnippet() {
    
    shell.setLayout(new FillLayout());
    
    TabFolder tabFolder = new TabFolder(shell, SWT.NONE);
    TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
    tabItem.setText("A TabItem"); //$NON-NLS-1$
    
    Composite composite = new Composite(tabFolder, SWT.NONE);
    composite.setLayout(new GridLayout());
    
    ToolBar toolBar = new ToolBar(composite, SWT.FLAT);
    ToolItem toolItem = new ToolItem(toolBar, SWT.NONE);
    toolItem.setText("A ToolItem with non-matching background"); //$NON-NLS-1$
    
    tabItem.setControl(composite);
    
    shell.open();
  
    while (!shell.isDisposed())
      if (!display.readAndDispatch())
        display.sleep();
    
    display.dispose();
    
  }

}


When executed on GTK (2.18.3), this displays as follows:

http://i253.photobucket.com/albums/hh73/ngc_2997/ToolItem.jpg

Is this intentional, or rather a bug?

Kind regards,
Karsten
Re: ToolBar/ToolItem background colour on TabItems [message #529543 is a reply to message #529371] Mon, 26 April 2010 06:27 Go to previous messageGo to next message
Praveen  is currently offline Praveen
Messages: 86
Registered: July 2009
Member
Karsen, I am not able to see any image/attachment with your post. Can
you please attach that ?
When I tried recreating using your snippet on Gtk2.6, I have seen the
appearance of toolItem as expected without any problem.
Re: ToolBar/ToolItem background colour on TabItems [message #529551 is a reply to message #529371] Mon, 26 April 2010 06:52 Go to previous message
Karsten Stöckmann is currently offline Karsten Stöckmann
Messages: 12
Registered: July 2009
Junior Member
Hm, seems I am not allowed to attach files to a posting..

You should be able to see the attachment here.. But that is in fact the same URL as in my initial posting, so you might not see the image either. If so, I might try and send you a PM or an e-mail with the image attached.

Kind regards,
Karsten
Previous Topic:How do I open office documents using SWT
Next Topic:\u0000 in strings behaviour intended?
Goto Forum:
  


Current Time: Sat Aug 02 00:38:59 EDT 2014

Powered by FUDForum. Page generated in 0.07808 seconds