Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Actual background color of TabFolder contents

Hi,

it seems there has been quite some effort invested to get controls inside a TabFolder to draw with the correct background. I've found a number of bug-reports, many tutorials, but nothing concerning the actual problem I have:

I want to display a wrapping help message below some controls inside a TabFolder, and the help message shall contain icons within the text.

Not going into the details of how exactly, I should be able to use a StyledText-widget for this. In this situation, the StyledText-widget shall have no border and assume the same background color as the Composite to which it is added. Which shall be the TabFolder background color.

This should simply be:

styledText.setBackground(styledText.getParent().getBackground());

However, this does not return the color which is actually seen in the parent widget. The implementation of getBackground() tries to find the widget that is actually responsible for the color. And I guess the TabFolder itself actually /has/ gray as background, which can be seen in the area outside the tabs. The contents of the TabFolder however has a different color (Windows: white, macOS: lighter gray), leading to the situation that getBackround() returns a wrong color. I guess it only works, because most controls rely on the system to clear the background before they paint the foreground. Which StyledText specifically avoids by forcing the NO_BACKGROUND style flag.

Any advice?

Best regards,
-Stephan




Back to the top