Hi Chris,
I don't know maybe I'm doing something wrong but code like this:
PGroup group_other = new PGroup(form, SWT.SMOOTH);
group_other.addControlListener(new Relayout());
group_other.setExpanded(false);
group_other.setBackgroundMode(SWT.INHERIT_DEFAULT);
group_other.setBackground(group_other.getDisplay().getSystemColor(SWT.COLOR_WHITE));
Leaves white edges at the bottom and top! Is there something I'm doing
wrong? Adding the 2 lines from this post fixes the problem reveals
another one because when putting Group-Widgets inside the PGroup their
border is not rendered any more.
I've tested with WinXP and Eclipse-3.3.
Tom
Chris Gross schrieb:
Hi Swavek,
PGroup is designed to correctly show the parent's background if you
use the SWT background mode features. If you call
setBackgroundMode(SWT.INHERIT_DEFAULT) then you should see the
background color of the parent bleed through correctly.
Regards,
-Chris
Swavek Lorenc wrote:
I ran into a painting problem with PGroup which has rounded corners.
When you set PGroups background to something other than the parent
control's background Pgroup's background bleeds outside the 4 rounded
corners.
I fixed this problem by adding 2 lines of code in
RectangleGroupStrategy's paint method and would like to offer this
fix to be incorporated into the code.
First I set the background color to parent's color around line 136.
See à
Color back = getGroup().internalGetBackground();
if (back != null)
{
// fill background with parent color so the areas outside
the rounded edges have the same color as parent
à gc.setBackground(getGroup().getParent().getBackground());
// added line
gc.fillRectangle(0,0,getGroup().getSize().x,getGroup().getSize().y);
The second place where this fix is made is in the code which paints
the bottom rounded rectangle around line 404.
gc.setClipping(reg);
// fill the background constrained by the clipping
region
à gc.fillRectangle(0, titleHeight,
getGroup().getSize().x - 1, getGroup().getSize().y - titleHeight);
// added line
// draw rounded bottom border
GraphicUtils.drawRoundRectangle(gc, 0, titleHeight,
getGroup().getSize().x - 1,
getGroup().getSize().y - titleHeight, null, false,
true);
reg.dispose();
Swavek Lorenc
slorenc@xxxxxxxxxxx