Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to scroll down the vertical bar?
How to scroll down the vertical bar? [message #512765] Sun, 07 February 2010 11:51 Go to next message
antonio is currently offline antonioFriend
Messages: 22
Registered: July 2009
Junior Member
Hi,

I need to scroll down the vertical bar (of a table and tree) to the last row programmatically. I use this:

// before add an element on a tree or table
vb.setSelection(vb.getMaximum());
vb.notifyListeners(SWT.Selection, new Event());

I've tried without success with:
vb.setSelection(vb.getMaximum() + vb.getIncrement());

Actually scroll happens tho not to the last line but until the row before the last.

Have you any idea?


Thanks,
Julio
Re: How to scroll down the vertical bar? [message #513034 is a reply to message #512765] Mon, 08 February 2010 15:36 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Hi Julio,

This approach won't work, native Tables/Trees do not react to programmatic
changes to their scrollbars. To do this you need to use something like
table.setTopIndex(table.getItemCount()).

Grant


"antonio" <antongiulio05@gmail.com> wrote in message
news:hkm9fs$bav$1@build.eclipse.org...
> Hi,
>
> I need to scroll down the vertical bar (of a table and tree) to the last
row programmatically. I use this:
>
> // before add an element on a tree or table
> vb.setSelection(vb.getMaximum());
> vb.notifyListeners(SWT.Selection, new Event());
>
> I've tried without success with:
> vb.setSelection(vb.getMaximum() + vb.getIncrement());
>
> Actually scroll happens tho not to the last line but until the row before
the last.
>
> Have you any idea?
> --
> Thanks,
> Julio
Re: How to scroll down the vertical bar? [message #513046 is a reply to message #513034] Mon, 08 February 2010 16:30 Go to previous message
antonio is currently offline antonioFriend
Messages: 22
Registered: July 2009
Junior Member
Hi Grant,

thank you very much for ur hint. Following ur suggestion I've solved with:

table.setTopIndex(table.getItemCount()-1);

and

tree.setTopItem(lastTreeItemAppended);


Thanks,
Julio
Previous Topic:Has StyledText a maximum input for data?
Next Topic:SWT Browser loss its focus when Browser.evaluate() is called
Goto Forum:
  


Current Time: Thu Dec 05 17:29:15 GMT 2024

Powered by FUDForum. Page generated in 0.02663 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top