I have an RCP/SWT application in which I'm trying to construct a view out of existing composites. One is a FillLayout composite, the other uses GridLayout.
I'd to like to end up with a view in which the GridLayout composite is lined up to the left of the FillLayout composite (think vertical banner) and is about 10 percent the width of the entire view, with the existing FillLayout composite comprising the other 90 percent.
I'm not sure if it is possible in SWT to combine layouts, but I'm thinking something like a GridLayout with two columns. Column one would contain the GridLayout widget and column two would contain the FillLayout composite. Can this be done in SWT? If so, what does this look like code-wise?
Thanks-
You can use the following code as a starting point:
It looks like this:
It's basically a
SashForm
with two parts. The left part is aGridLayout
with three columns and the right part is aGridLayout
with one column. No need to mixLayout
s.The percentage is set with
form.setWeights(new int[] {4, 1});
Start setting a
FormLayout
to your outer composite. Place two other composites inside it, setting theirFormData
information to position them as you please. Then set those two composite's layouts (Grid and Fill, as you said).Here's some code to start. There's an image after it showing what it produces. You might also check out Eclipse's SWT Layouts view.