[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: ScrollBar auto scroll back
|
Hi,
ScrolledComposite should not do this, and my snippet below doesn't, so it
must be more specific to your context. Are you able to change the snippet
to show it happening? The snippet is based on the lines that you originally
gave, but a few had to change to make it run stand-alone.
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
final ScrolledComposite sc = new ScrolledComposite(shell, SWT.V_SCROLL |
SWT.H_SCROLL);
sc.setAlwaysShowScrollBars(true);
final Composite mycomposite = new Composite(sc, SWT.NONE);
mycomposite.setSize(800,800);
sc.setContent(mycomposite);
sc.setMinSize(mycomposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
// sc.setExpandHorizontal(true);
// sc.setExpandVertical(true);
sc.getVerticalBar().setIncrement(sc.getVerticalBar().getIncrement() *
5);
shell.setBounds(10, 10, 200, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
Grant
"glamakid" <glamkid@xxxxxxxxxxx> wrote in message
news:519a34207e0b21f2ebbd657f28842b98$1@xxxxxxxxxxxxxxxxxx
> Hello Team,
>
> I am creating a scroller using the following code
>
> public Composite Create(final Composite baseComposite) {
> final ScrolledComposite sc = new ScrolledComposite(
> baseComposite, SWT.V_SCROLL | SWT.H_SCROLL );
> sc.setAlwaysShowScrollBars(true);
>
> final Composite mycomposite = toolkit.createComposite(sc,
> SWT.NONE);
>
> sc.setContent(mycomposite);
> sc.setMinSize(mycomposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
>
> sc.setExpandHorizontal(true);
> sc.setExpandVertical(true);
> System.out.println("imran");
> sc.getVerticalBar().setIncrement(sc.getVerticalBar().getIncrement()*5);
>
> return scomposite;
> }
>
>
> My problem is , when i scroll down and then go to other window (using
> Alt+Tab) and then come back to my application, scroller goes back to
> initial position. Any idea?
> Thank you
>