| Summary: | Layout problem on 1st run only | ||
|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Setya Nugdjaja <jsetya> |
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> |
| Status: | RESOLVED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | All | ||
| Whiteboard: | |||
Hi Setya, I think that this is not a bug at all. If you set a background color on the widgetContainer composite, you will see that this composite is not resized when you click on show/hide button. And this is correct, because you do the layout of this composite only (widgetContainer.layout(true, true)), when you click on the button. Using parent.layout(true, true) instead solves the problem. Hi, Thank you for your time to take a look at this bug. I've also found that changing the line: widgetContainer.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); into widgetContainer.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); fixed the problem. I thought this was a bug merely because in RCP exactly the same snippet worked perfect. Best Regards, Setya I will close it as invalid. If you disagree please reopen it. |
Build Identifier: I'm using the following snippet to reproduce the problem: ... @Override public void createPartControl(final Composite parent) { parent.setLayout(GridLayoutFactory.fillDefaults().create()); toolkit.adapt(parent); final Composite widgetContainer = toolkit.createComposite(parent); widgetContainer.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).spacing(8, 5).margins(10, 10).create()); widgetContainer.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); Composite container = toolkit.createComposite(widgetContainer); container.setLayout(GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 10).spacing(10, SWT.DEFAULT).create()); container.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).span(2, 1).grab(true, false).create()); final Text firstText = toolkit.createText(widgetContainer, null, SWT.BORDER); firstText.setLayoutData(GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).hint(SWT.DEFAULT, 17).grab(true, false).create()); Button button = toolkit.createButton(container, "Hide", SWT.PUSH); button.setLayoutData(GridDataFactory.swtDefaults().create()); SelectionAdapter adapter = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean hidden = GridData.class.cast(firstText.getLayoutData()).exclude; if (hidden) { GridData.class.cast(firstText.getLayoutData()).exclude = false; firstText.setVisible(true); Button.class.cast(e.widget).setText("Hide"); } else { GridData.class.cast(firstText.getLayoutData()).exclude = true; firstText.setVisible(false); Button.class.cast(e.widget).setText("Show"); } widgetContainer.layout(true, true); } }; button.addSelectionListener(adapter); } Follow the steps to reproduce the problem and I notice the following: 1. After 2nd step the text widget is partially hidden. 2. After 4th step the text widget is fully visible again. I've tried the same snippet on RCP and it works fine there. Best Regards, Setya Reproducible: Always Steps to Reproduce: 1. Click 'Hide' button. 2. Click 'Show' button. 3. Close & reopen editor. 4. Repeat step 1 & 2 above.