Community
Participate
Working Groups
Created attachment 252477 [details] Screenshot showing the problem This may be related to Bug 463127. I'm trying to create a 'Glass Pane', that is a Composite with a transparent background that sits above other composites. My expectation is that widgets that makeup the concealed composite will show through the transparent 'glass pane' composite. This works on MacOS, but not windows. On Windows, setting the glass pane to transparent does not show the concealed widgets. The background color of the hidden composite will 'bleed through' but not the widgets. I'll attach a screenshot showing the platform differences and a code snippet that reproduces this problem. The screenshot shows composite A behind composite B. Composite A has two buttons on it, and composite B has a single button (called hide) and a transparent background. On Mac, the Composite A can be seen behind composite B. However, on Windows, composite B is drawn with a white background.
Created attachment 252478 [details] Snippet showing the problem Here is the snippet I used. I've tested this on I20150414-1400.
(In reply to Ian Bull from comment #0) > Created attachment 252477 [details] > Screenshot showing the problem > > This may be related to Bug 463127. No, that's a different problem, related to composite with Scrollbars. Here, in attached snippet you are using absolute layout(using setBounds()) to layer one Composite on top of other composite... to achieve GlassPane kind of behavior.
(In reply to Niraj Modi from comment #2) > (In reply to Ian Bull from comment #0) > > Created attachment 252477 [details] > > Screenshot showing the problem > > > > This may be related to Bug 463127. > No, that's a different problem, related to composite with Scrollbars. > > Here, in attached snippet you are using absolute layout(using setBounds()) > to layer one Composite on top of other composite... to achieve GlassPane > kind of behavior. Is there a better layout to use? I tried a stack layout, but that didn't work either. All other layouts (Grid, fill, row, form) work hard not to have overlapping widgets, so the only solution I came up with was an absolute layout.
Created attachment 252538 [details] Snippet working with NO_BACKGROUND style on GlassPane Composite. (In reply to Ian Bull from comment #3) > (In reply to Niraj Modi from comment #2) > > (In reply to Ian Bull from comment #0) > > > Created attachment 252477 [details] > > > Screenshot showing the problem > > > > > > This may be related to Bug 463127. > > No, that's a different problem, related to composite with Scrollbars. > > > > Here, in attached snippet you are using absolute layout(using setBounds()) > > to layer one Composite on top of other composite... to achieve GlassPane > > kind of behavior. > > Is there a better layout to use? I tried a stack layout, but that didn't > work either. All other layouts (Grid, fill, row, form) work hard not to > have overlapping widgets, so the only solution I came up with was an > absolute layout. Got the GlassPane behavior working on Windows too. On Windows, it's required to apply SWT.NO_BACKGROUND style on the Composite which you are using as GlassPane... please refer updated snippet attached.
(In reply to Niraj Modi from comment #4) > Created attachment 252538 [details] > Snippet working with NO_BACKGROUND style on GlassPane Composite. > Got the GlassPane behavior working on Windows too. > On Windows, it's required to apply SWT.NO_BACKGROUND style on the Composite > which you are using as GlassPane... please refer updated snippet attached. SWT.NO_BACKGROUND is very different from transparency. SWT.NO_BACKGROUND does not draw the background of the widget. There is a slight difference (as it mentions in the docs for SWT.NO_BACKGROUND). The by not drawing the background, it takes the current pixels (a snapshot at that time) that makeup the area behind the composite. However, if those change (say your resize the shell, or something else changes behind the glass pane) it's not updated. In fact, just having SWT.NO_BACKGROUND has always had this behaviour (before SWT.TRANSPARENCY was ever introduced). On Mac, with SWT.TRANSPARENCY you now have a real 'glass pane' where composite below 'bleeds through' -- not just using a snapshot in time.
Here is what the docs say for NO_BACKGROUND: <snip> By default, before a widget paints, the client area is filled with the current background. When this style is specified, the background is not filled, and the application is responsible for filling every pixel of the client area. This style might be used as an alternative to "double-buffering" in order to reduce flicker. This style does not mean "transparent" - widgets that are obscured will not draw through. </snip>
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.