Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » ToolItems in section#textClient gets white background instead of being transparent
ToolItems in section#textClient gets white background instead of being transparent [message #986928] Thu, 22 November 2012 06:47 Go to next message
Edvin Syse is currently offline Edvin Syse
Messages: 2
Registered: July 2009
Junior Member
I've added buttons to a Section in a Form by creating a ToolBar and setting it as the Section's textClient. When I add ToolItems to the ToolBar and set a transparent png as the icon image, the area background of the button is white instead of showing the gradient from the Section behind it. Is there a way to override the background drawing, or should I use another approach to add buttons to the Section?

Here is the code I use to create the Toolbar and populate it with a button:

ToolBar toolbar = new ToolBar(section, SWT.NONE);
section.setTextClient(toolbar);

ToolItem item = new ToolItem(toolbar, SWT.PUSH);
item.setImage(myTransparentIcon);


I've attached an image that shows how it renders now.
  • Attachment: section.png
    (Size: 2.21KB, Downloaded 69 times)
Re: ToolItems in section#textClient gets white background instead of being transparent [message #987094 is a reply to message #986928] Fri, 23 November 2012 07:39 Go to previous message
Edvin Syse is currently offline Edvin Syse
Messages: 2
Registered: July 2009
Junior Member
I ended up with throwing the ToolBar and ToolItems out the Windows for a custom Composite with an ImageHyperlink. Transparency worked out of the box there:

Composite toolbar = new Composite(section, SWT.NO_BACKGROUND);
toolbar.setLayout(new FillLayout(SWT.HORIZONTAL));
section.setTextClient(toolbar);

ImageHyperlink link = new ImageHyperlink(toolbar, SWT.WRAP);
link.setToolTipText(title);
link.addHyperlinkListener(onclick);
link.setImage(image);


See attached image for the result.
  • Attachment: section.png
    (Size: 2.04KB, Downloaded 78 times)
Previous Topic:"The parameter 'path' must not be null" when running RAP with Workbench
Next Topic:RAP and OSGi Services
Goto Forum:
  


Current Time: Thu Aug 21 16:10:23 EDT 2014

Powered by FUDForum. Page generated in 0.01638 seconds