Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Creating Extra Composites
Creating Extra Composites [message #308232] Sun, 17 September 2006 15:15 Go to next message
Eclipse UserFriend
Hi Folks,

I've seen lots of SWT content creation samples that implement a method
which takes a parent Composite by immediately creating a composite from
the parent composite. For example:

public void createPartControl(Composite parent) {
Composite myParent = new Composite(parent, SWT.NONE);
// ... proceed to add children to myParent
}

I would naively be inclined to simply add my child components to the
oringal parent rather than creating another parent. Why the creation of
an extra composite?

The only purpose I could imagine would be that the framework has its own
intended layout manager for the parent composite and doesn't want me
assigning my own. By creating child composite, any layout assignments
don't affect the original parent parameter. Is this the reason?

- Paul
Re: Creating Extra Composites [message #308254 is a reply to message #308232] Mon, 18 September 2006 10:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Basically yes. It also means that the parent composite's layout manager
will only need to deal with one child, the new composite you just
created. It doesn't need to worry about other children to layout.

>
> The only purpose I could imagine would be that the framework has its own
> intended layout manager for the parent composite and doesn't want me
> assigning my own. By creating child composite, any layout assignments
> don't affect the original parent parameter. Is this the reason?
>
> - Paul
Re: Creating Extra Composites [message #308260 is a reply to message #308232] Mon, 18 September 2006 12:30 Go to previous message
Eclipse UserFriend
Also, the workbench sets the layout for the parent composite for views
and editors to FillLayout. There's nothing wrong with slapping controls
right on the parent composite ... as long as you don't change the layout.

Later,
PW
Previous Topic:How do I get the shell or shell provider and the selection provider of the "Navigator"?
Next Topic:Problem with the editor site
Goto Forum:
  


Current Time: Mon Jun 02 12:52:54 EDT 2025

Powered by FUDForum. Page generated in 0.23917 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top