|
Re: ScrolledComposite question [message #438410 is a reply to message #438338] |
Wed, 23 June 2004 07:01 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: ramim.kauhajoki.fi
Hi,
Here's my solution on this problem. I solved it by setting 3 Inner
Composites. One base which contains a Scrolled composite which contains
THE Composite which holds the widgets. Don't know is this the most simple
way to do this but this works atleast. If you find better one, please post
it here !!
// First create the "base composite"
Composite baseComposite = new Composite(getContainer(), SWT.NONE);
Display display = baseComposite.getShell().getDisplay();
Color white = new Color(display, 255,255,255);
FillLayout layout2 = new FillLayout();
baseComposite.setLayout(layout2);
// create the Composite which can be scrolled up and down
ScrolledComposite scrollComp = new ScrolledComposite(baseComposite,
SWT.H_SCROLL | SWT.V_SCROLL);
scrollComp.setAlwaysShowScrollBars(false);
baseComposite.layout(true);
// create a new Composite inside the ScrolledComposite
// which will contain all the Labels and other widgets
Composite composite = new Composite(scrollComp, 0);
scrollComp.setContent(composite);
composite.setBackground(white);
GridLayout layout = new GridLayout();
layout.numColumns = 4;
composite.setLayout(layout);
// set all the widgets here (on the composite widget)
// and finally maximize the editors's (=composite) width
Point pt = composite.computeSize(SWT.NORMAL, SWT.MAX);
scrollComp.setExpandHorizontal(true);
scrollComp.setExpandVertical(true);
scrollComp.setMinWidth(pt.x);
scrollComp.setMinHeight(pt.y);
I hope this helps you a little bit :)
Alex Iskold wrote:
> Hi,
> I am trying to figure out how to make ScrolledComposite stretch its
> content and for the scrolls to still appear when necessary. If use
> setExpandHorizontal(true)
> method, then the contents are stretched, but the scroll does not appear.
> Conversely, calling above method with false arg results in scroll bars,
> but the content is not stretched. Is it possible to make it look like this:
> --------------------------
> | | S
> | | C
> | STRECHED | R
> | CONTENT | O
> | | L
> | | L
> --------------------------
> Thank you,
> Alex
|
|
|
Powered by
FUDForum. Page generated in 0.04072 seconds