Skip to main content


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 11:47 Go to next message
Edvin Syse is currently offline Edvin SyseFriend
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 197 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 12:39 Go to previous message
Edvin Syse is currently offline Edvin SyseFriend
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 210 times)
Previous Topic:FileUpload UI component "Browse" button
Next Topic:RAP and OSGi Services
Goto Forum:
  


Current Time: Thu Apr 25 05:33:24 GMT 2024

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

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

Back to the top