[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform.swt] Re: how to make a scrollable view ?

I've tried and get scrollbars in the view.
But I can't add a Label or Button to. They are not in the scrolled area.
I'm a bit newbie in java and eclipse, and think I missed something.
Here's my code:

  public void createPartControl(Composite parent) {
  	parent.setLayout(new FillLayout());
  	
  	ScrolledComposite sc1 = new ScrolledComposite(parent, SWT.H_SCROLL |
SWT.V_SCROLL | SWT.BORDER);
  	sc1.setContent(parent);

        new Label(parent, SWT.NONE).setText("text");
  	new Button(parent, SWT.PUSH).setText("button ");
  }

I think the pb comes from the composite. In the example shown in the
source class, there is a composite created :composite c1(sc1,
SWT.H_SCROLL). But I already have a composite(parent) given as a parameter
when the view is created.
What to do?
Thx for your help
anthony


Veronika Irvine wrote:

> Try using ScrolledComposite (org.eclipse.swt.custom).

> "anthony saucet" <anthony.saucet@xxxxxxxxxxx> wrote in message
> news:b9tn7t$83f$1@xxxxxxxxxxxxxxxx
> > I have a View with a GridLayout. I want this view to be scrollable
> > (H_SCROLL and V_SCROLL).
> > How can I do that ?
> > Have I to change the layout, 'cause GridLayout does not allow ? I've tried
> > with FillLayout but no change.
> >
> > thx
> > anthony
> >