Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 150024 - Group control borders disappear not when tabbing
Summary: Group control borders disappear not when tabbing
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-07 14:18 EDT by icemank CLA
Modified: 2021-12-16 14:03 EST (History)
3 users (show)

See Also:


Attachments
Screenshot showing problem (8.89 KB, image/jpeg)
2006-07-07 14:20 EDT, icemank CLA
no flags Details
Test case (970 bytes, text/plain)
2006-07-07 14:21 EDT, icemank CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description icemank CLA 2006-07-07 14:18:36 EDT
I have a GEF editor similar to VE which creates figures by scraping SWT widget images.
In Draw2D 3.2, I have noticed a painting problem with Group widgets on a FigureCanvas.
I am attaching a screenshot and a test case to duplicate the problem.
Comment 1 icemank CLA 2006-07-07 14:20:00 EDT
Created attachment 45944 [details]
Screenshot showing problem

See the blank space on the right side of the Group border.
Comment 2 icemank CLA 2006-07-07 14:21:12 EDT
Created attachment 45945 [details]
Test case

Test case to reproduce the problem.
You will need to add draw2d to the build path and then run as SWT application.
Comment 3 Randy Hudson CLA 2006-07-10 11:00:43 EDT
I reproduced this, but I have no idea how our Canvas can paint on top of one of its children.
Comment 4 icemank CLA 2006-07-10 13:39:20 EDT
Interesting quirks about this bug. The problem goes away if:
1. The Group text is changed to "Lorem ipsum dolor"
or
2. The Group width is increased to 217 (up from 187)
or
3. The Group x location is changed to 0 (from 77)
Comment 5 Pratik Shah CLA 2006-07-10 18:56:45 EDT
To better see the problem, add this line of code:

group.setBackground(ColorConstants.yellow);

Note that the inner rectangle is the same width as that of the group's text and is offset from the group's top left corner by about the same amount as the group's location (ie, group's offset inside the canvas).
Comment 6 Randy Hudson CLA 2006-07-10 21:28:19 EDT
Within the group, the mysterious box occurs at the same location at which the group's label appears relative to its parent composite.

Moving to SWT, as I can't imagine that anything GEF does would "bleed through" a child control. I tried to create a simple Canvas test case but I couldn't easily remove all of the draw2d gorp.
Comment 7 icemank CLA 2006-07-11 10:34:12 EDT
The culprit is the LightweightSystem.
Comment the line in the FigureCanvas constructor which sets the LWS control and the mystery box disappears.
Comment 8 Randy Hudson CLA 2006-07-11 10:51:18 EDT
With the following snippet, the Group's outline completely disappears:

    public static void main (String [] args)
    {
        final Display display = new Display ();
        final Shell shell = new Shell (display);
        FillLayout fillLayout = new FillLayout();
        fillLayout.marginHeight = fillLayout.marginWidth = 5;
        shell.setLayout(fillLayout);
        Canvas canvas = new Canvas(shell, SWT.NO_BACKGROUND | SWT.DOUBLE_BUFFERED
			| SWT.NO_REDRAW_RESIZE | SWT.H_SCROLL | SWT.V_SCROLL);
        canvas.getHorizontalBar().setVisible(false);
        canvas.getVerticalBar().setVisible(false);
        canvas.addPaintListener(new PaintListener() {
			public void paintControl(PaintEvent e) {
				e.gc.setClipping(e.x, e.y, e.width, e.height);
				e.gc.fillRectangle(e.x, e.y, e.width, e.height);
			}
		});
        Group group = new Group(canvas, SWT.NONE);
        group.setBounds(new Rectangle(77,72,187,113));
        group.setText("Lorem ipsum dolor sit amet");

        shell.setSize (400, 400);
        shell.open ();
        while (!shell.isDisposed ()) {
            if (!display.readAndDispatch ()) display.sleep ();
        }
        display.dispose ();
    }
Comment 9 Grant Gayed CLA 2006-07-18 17:07:39 EDT
SN, note that comment 8 only makes the Group's border disappear on XP; the border is still visible when I run the snippet on win2000.
Comment 10 Steve Northover CLA 2006-09-25 19:35:20 EDT
Sure you can draw on top of the border of a group (on some platforms).  You should only be drawing withing the client area.
Comment 11 Randy Hudson CLA 2006-09-25 21:40:36 EDT
(In reply to comment #10)
> Sure you can draw on top of the border of a group (on some platforms).  You
> should only be drawing withing the client area.

The group is not painting on top of its own border.  The Canvas is painting on top of the group's border. That should be impossible. Remember how we painted connections in VA-Java (composite painted over top of its children)? That is not supported in SWT.
Comment 12 Steve Northover CLA 2006-09-26 10:25:55 EDT
>The Canvas is painting on top of the group's border.

The group's border isn't an SWT.BORDER.  It is painted by the group (on Windows).  If you call getClientArea() on a group, the origin will not be (0, 0).  On Windows, it is possible to draw on top of a group's border.
Comment 13 Randy Hudson CLA 2006-09-26 14:45:02 EDT
> 0).  On Windows, it is possible to draw on top of a group's border.

That's a red herring.  No one is drawing on the group, period. A Canvas can not paint on top of its children.

I think this is related to the general problems with group borders not showing up, but it should be resolved as a dupe instead of wontfix.
Comment 14 Steve Northover CLA 2006-09-26 15:19:44 EDT
Right, the group is a child of the canvas so the canvas can't draw on top.
Comment 15 Steve Northover CLA 2006-09-26 15:22:03 EDT
My mistake ... reopening.
Comment 16 Steve Northover CLA 2006-09-26 15:24:33 EDT
Seems that the SWT.NO_BACKGROUND bit is causing the trouble.
Comment 17 Steve Northover CLA 2007-04-09 14:25:09 EDT
Here is simpler code that fails:

public static void main(String[] args) {
        final Display display = new Display();
        final Shell shell = new Shell(display);
        FillLayout fillLayout = new FillLayout();
        fillLayout.marginHeight = fillLayout.marginWidth = 5;
        shell.setLayout(fillLayout);
        Canvas canvas = new Canvas(shell, SWT.NONE);
        canvas.addPaintListener(new PaintListener() {
                public void paintControl(PaintEvent e) {
                        e.gc.setClipping(e.x, e.y, e.width, e.height);
//                      e.gc.fillRectangle(e.x, e.y, e.width, e.height);
                }
        });
        Group group = new Group(canvas, SWT.DEFAULT);
        group.setBounds(new Rectangle(77, 72, 187, 113));
        group.setText("Lorem ipsum dolor sit amet");
        shell.setSize(400, 400);
        shell.open();
        while (!shell.isDisposed()) {
                if (!display.readAndDispatch())
                        display.sleep();
        }
        display.dispose();
}
Comment 18 Eclipse Webmaster CLA 2019-09-06 15:35:18 EDT
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.

If you have further information on the current state of the bug, please add it. 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.
Comment 19 Eclipse Genie CLA 2021-12-16 14:03:44 EST
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.