[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Problems with controls background laid on Group, relevant only for Mac

Hi, sorry for the late response,

This is somewhat intentional, but is probably not the correct behaviour for
your case.  The 0.25 alpha is meant to emulate the way that a native group's
background is auto-set to be a bit darker than its parent (you can see this
in Interface Builder by nesting a few levels of groups).  However it
probably should not be doing this in your case since you're setting its
background explicitly.  I've logged
https://bugs.eclipse.org/bugs/show_bug.cgi?id=234240 .  This will not be
fixed for 3.4 because it's too late to consider changes like this.

Grant


"Yuliya" <julia.poleno@xxxxxxxxx> wrote in message
news:g0eulj$j6b$1@xxxxxxxxxxxxxxxxxxxx
> Hello everybody!
>
> We have faced such problem under Mac platform: if some control, except
> of Text, is laid on Group this control saves 25% of own background color.
>
>
> Here is the source code
>
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.layout.FillLayout;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Group;
> import org.eclipse.swt.widgets.Label;
> import org.eclipse.swt.widgets.Shell;
>
> public class MacBackgroundDemo {
>
>    public static void main(final String[] args) {
>
>      final Display display = new Display();
>      final Shell shell = new Shell(display);
>      shell.setLayout(new FillLayout());
>
>      Group group = new Group(shell, SWT.SHADOW_NONE);
>      group.setText("Example");
>
>      group.setLayout(new FillLayout());
>
>      Label label = new Label(group, SWT.CENTER);
>      label.setText("...TEST...");
>      label.setBackground(Display.getCurrent()
>           .getSystemColor(SWT.COLOR_RED));
>
>      shell.pack();
>      shell.open();
>      while (!shell.isDisposed()) {
>        if (!display.readAndDispatch())
>          display.sleep();
>      }
>      display.dispose();
>    }
> }
>
>
> This code is respected under Windows platform totally, but under Mac
> platform we receive different background for Label.
>
> My best suggestion is: in Control we have drawBackground() method where
> we invoke getThemeAlfa() - which is normally looks like that:
>
> float getThemeAlfa() {
>    return 1 * parent.getThemeAlfa();
> }
>
> but in Group control under Mac platform this method is overridden like
that:
>
> float getThemeAlfa() {
>    return 0.25 * parent.getThemeAlfa();
> }
>
>
> The question is: was it maid intentionally or this is a bug? Will it be
> fixed in next version of Eclipse? (now I'm using 3.3.1.1)