Summary: | Nested GridLayout allows child to be larger than parent | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] Platform | Reporter: | Chris Merrill <st.eclipsebugs3> | ||||||
Component: | SWT | Assignee: | Veronika Irvine <veronika_irvine> | ||||||
Status: | NEW --- | QA Contact: | |||||||
Severity: | normal | ||||||||
Priority: | P3 | CC: | b.kratz, grant_gayed | ||||||
Version: | 3.1.1 | ||||||||
Target Milestone: | --- | ||||||||
Hardware: | PC | ||||||||
OS: | Windows XP | ||||||||
Whiteboard: | |||||||||
Attachments: |
|
Description
Chris Merrill
2006-08-03 10:00:15 EDT
Created attachment 47321 [details]
Example of nested grid layout problem
// use this line to see the bug _inner_panel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1)); In the code above you are not grabbing excess horizontal space (the value is false), instead you are saying that the child should be its preferred size - the preferred size of the child can be bigger than the available space in the client area of the parent. // use this line for it to work correctly. //_inner_panel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); In the code above you are grabbing excess horizontal space (the value is true). This means that the child will not be wider than the available area in the parent's client area. According to your comments, the code above is doing what I would expect, I am not sure what the bug is. I have not run your code because I do not have JFace installed. Are your code comments incorrect? The comments are correct. The problem is that when the InnerPanel is allowed to be it's preferred size, it causes the parent container (OuterPanel) to become larger than it's container and causes other controls within the OuterPanel to grow as well. According to the javadocs for GridData.grabExcessHorizontalSpace : "If there is not enough horizontal space available in the parent, the cell will shrink until it reaches its minimum width as specified by GridData.minimumWidth." The default minimum width (0) is used. So, if my understanding of the javadocs is correct, no setting of the grabExcessHorizontalSpace parameter should allow children in a container with a GridLayout to be larger than the parent. Is this incorrect? I will attach a screenshot. The grey background in the screenshot is the OuterPanel and the yellow background is the InnerPanel. You can see that the InnerPanel and other controls in the OuterPanel become larger than the parent container. Or maybe the OuterPanel grows larger than _its_ parent (red background) -- but that has a FillLayout and the javadocs for FillLayout indicate that it does not allow its children to be larger than the container, either. I encourage you to find somebody who can run the code so you can see it in action. Created attachment 47542 [details]
screenshot of the problem
This shows that children of the OuterPanel (grey background) are allowed to become larger than the container if the InnerPanel (yellow background) is not set to grab excess horizontal space.
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. |