[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.platform.swt] Re: how to make a scrollable view ?
|
Hi,
I think you should use ScrolledComposite.setContent to set its content, ie.:
ScrolledComposite sc1 = new ScrolledComposite(parent,SWT.H_SCROLL |
SWT.V_SCROLL | SWT.BORDER);
Composite comp = new Composite(sc1, SWT.NONE);
new Label(comp, SWT.NONE).setText("text");
new Button(comp, SWT.NONE).setText("button");
sc1.setContent(comp);
This should work (according to the javadoc of ScrolledComposite).
HTH,
Regards,
Csaba
"anthony saucet" <anthony.saucet@xxxxxxxxxxx> wrote in message
news:bacrsg$qbm$1@xxxxxxxxxxxxxxxx
> I still have a scrollable view but without Label or Button. They don't
> appear in the view. I changed the code as you said, but still nothing in
> the view, except the scrollbars.
> public void createPartControl(Composite parent) {
> parent.setLayout(new FillLayout());
> ScrolledComposite sc1 = new ScrolledComposite(parent,SWT.H_SCROLL
|
> SWT.V_SCROLL | SWT.BORDER);
> sc1.setLayout(new FillLayout());
> new Label(sc1, SWT.NONE).setText("text");
> new Button(sc1, SWT.NONE).setText("button");
> }
>
> anthony
>
>
> Buddha wrote:
>
> > You are creating the Label and Button with the incorrect parent. You
want
> > them in the ScrolledComposite, so that is what their parent should be.
>
> > sc1.setLayout(new FillLayout());
> > new Label(sc1, SWT.NONE).setText("text");
> > new Button(sc1, SWT.NONE).setText("button");
>
> > anthony saucet wrote:
>
> > > 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
> > > > >
>
>
>
>
>
>
>
>
>
>
>