Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 351994 - Deferred layouts can cause controls to not get a layout data set on them
Summary: Deferred layouts can cause controls to not get a layout data set on them
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-13 11:40 EDT by Remy Suen CLA
Modified: 2016-05-24 09:25 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Suen CLA 2011-07-13 11:40:32 EDT
Are clients supposed to be able to expect that their controls will have layout data automatically generated and set for them when their parent composite has been laid out?

In the case where the parent's composite's layout has been asked to be deferred, this automatic layout data generation will not happen and was the cause behind bug 345354.

Display display = new Display ();
Shell shell = new Shell (display);
shell.setLayout(new GridLayout());
Composite c = new Composite(shell, SWT.NONE);
shell.setLayoutDeferred(true);
shell.layout(true, true);
System.out.println(c.getLayoutData());
shell.dispose();
display.dispose();
Comment 1 Stefan Xenos CLA 2016-05-24 09:25:33 EDT
I can't find anything in the JavaDoc which promises that invocations of layout will attach layout data to the child widgets. I would also recommend against making such a promise in the future since doing so would complicate the already-complicated layout system even more. Also, third-party layouts which currently don't attach data to their children would break such a promise.

It is very easy for clients to invoke setLayoutData themselves if they want getLayoutData() to be non-null.