|
|
Re: [ECP] Custom Control always in a ScrolledComposite [message #1408660 is a reply to message #1408390] |
Fri, 15 August 2014 18:15 |
Charles Eutsler Messages: 19 Registered: July 2009 |
Junior Member |
|
|
The troublesome part of our form is defined as:
ViewForm
Categorization
Leaf Category one
...
Leaf Category troublesome
Custom Control troublesome
Custom Domain Model Reference
When the renderControl is called for the troublesome custom control, the hierarchy of composites leading to the renderControl's parent parameter is:
...
SashForm
ScrolledComposite
Composite
Composite
The last Composite is the renderControl method's parent parameter value.
Into the parent composite we build:
Composite (with GridLayout(2, false)
Label
Combo
TableViewer (with GridData(SWT.FILL, SWT.FILL, true, true, 2, 1))
So, the TableViewer should ultimately get all the real estate of the custom control not taken by the combo and its label (and any margins of the containing Composites).
The problem is that the ScrolledComposite is given all the real estate of its part of the SashForm and it displays scroll bars when the Composite it contains requires more area than is available in the ScrolledComposite's area.
The contained composite does not expand to fill the available space (nor do its children). The size of the topmost contained Composite is what is used to determine when scroll bars are displayed. The size of that Composite comes from the sizes of the components it contains (based on preferred dimensions and whatnot). But there is no filling of the ScrolledComposite.
What I think is needed here is to have the child of the SashForm be a simple Composite that gives its child all its real estate when it has a single, custom control as its child.
OK, I'm seeing a little bit of a problem here...I see that the View Model editor context menu lets me add a Control to a Leaf Category but it doesn't let me add a Custom Control. I seem to have defined the Custom Control somewhere then dragged it into the Leaf Category. The editor didn't help me create it there but it did let me move it there so I'm guessing it is valid and that the View Model editor is just missing the Custom Control entry in the context menu of the Leaf Category tree node.
|
|
|
|
Re: [ECP] Custom Control always in a ScrolledComposite [message #1409754 is a reply to message #1409667] |
Mon, 18 August 2014 23:24 |
Charles Eutsler Messages: 19 Registered: July 2009 |
Junior Member |
|
|
The problem is getting clearer to me. As it stands, it's beginning to look like we have to deal with the fact that our Custom Control is in a ScrolledComposite and we'll have to do something to accommodate that. Perhaps we can create our table such that it isn't in a ScrolledComposite of its own.
I don't see how the LayoutProvider suggestion can work. From what I can see, there can be only one LayoutProvider and there is one provided by the framework. It seems that a LayoutProvider is contributed by the org.eclipse.emf.ecp.ui.view.swt.layoutProvider extension point. org.eclipse.emf.ecp.view.spi.swt.layout.LayoutProviderHelper.checkProviderLength() throws an IllegalStateException when there is more than one LayoutProvider.
I don't see a way to specify a LayoutProvider control-by-control. Besides, the existing layout provider is already having controls fill the parent so I don't see what more we could have it do.
I see that my suggestion that a simple Composite be the parent of the contents of the SashForm when a single Custom Control is the only child won't work. It looks like the ScrolledComposite is the common parent control for all of the Categorization elements of the View Model.
Let me update my suggestion for making this work: If the Categorization element's control were a simple Composite (instead of a ScrolledComposite) and the Leaf Category elements were rendered by ScrolledComposites (rather than simple Composites), we probably could make things work the way we would like. In that case, I think we could provide a Renderer for the Category when it is one of ours that doesn't want to be in a ScrolledComposite.
But, of course, that could break existing code where people have made custom renderers for the Category level who expect their control to be in a ScrolledComposite.
[Updated on: Mon, 18 August 2014 23:37] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04816 seconds