| ScrolledComposite in a Dialog [message #319429] |
Mon, 20 August 2007 19:15  |
Eclipse User |
|
|
|
I have a dialog with enough controls in it that in certain resolutions,
the OK and Cancel button don't appear on the screen.
I've looked at lots of samples and tried lots of variations, but haven't
been able to create a ScrolledComposite within a Dialog that actually
works.
I can create one that has diabled scrollbars, but the scrollbars never
get activated.
Does anyone have a working example of a ScrolledComposite in a Dialog?
Thanks.
|
|
|
|
|
| Re: ScrolledComposite in a Dialog [message #319477 is a reply to message #319447] |
Wed, 22 August 2007 10:32  |
Eclipse User |
|
|
|
Here's a snippet:
public class SampleDialog extends TitleAreaDialog {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
SampleDialog dlg = new SampleDialog(shell);
dlg.open();
display.dispose();
}
public SampleDialog(Shell shell) {
super(shell);
}
protected Control createDialogArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout());
ScrolledComposite c1 = new ScrolledComposite(composite, SWT.BORDER |
SWT.H_SCROLL | SWT.V_SCROLL);
c1.setLayoutData(new GridData(700,700));
Button b1 = new Button(c1, SWT.PUSH);
b1.setText("fixed size button");
b1.setSize(1200, 1200);
c1.setContent(b1);
return composite;
}
}
Grant
"John Lawrence" <lawrence@us.ibm.com> wrote in message
news:46CAFBD4.8090507@us.ibm.com...
> Grant Gayed wrote:
> > for ScrolledComposite example snippets see
> > http://www.eclipse.org/swt/snippets#scrolledcomposite
> >
> > "John Lawrence" <lawrence@us.ibm.com> wrote in message
> > news:fad79l$rm2$1@build.eclipse.org...
> >> I have a dialog with enough controls in it that in certain resolutions,
> >> the OK and Cancel button don't appear on the screen.
> >>
> >> I've looked at lots of samples and tried lots of variations, but
haven't
> >> been able to create a ScrolledComposite within a Dialog that actually
> >> works.
> >>
> >> I can create one that has diabled scrollbars, but the scrollbars never
> >> get activated.
> >>
> >> Does anyone have a working example of a ScrolledComposite in a Dialog?
> >>
> >> Thanks.
> >
> >
> Thanks, Grant. I've seen that page and looked at the examples there.
> Those examples, however, don't create the ScrolledComposite within a
> dialog. I don't know why there should be a difference, but I'd like to
> see some working code that uses a dialog, as I haven't been able to get
> that to work.
>
> Thanks.
|
|
|
Powered by
FUDForum. Page generated in 0.06086 seconds