java - How to know if the user has scrolled to the end in an SWT Scrolled Bar? -
java - How to know if the user has scrolled to the end in an SWT Scrolled Bar? -
we have case need fire server phone call fetch next 100 records user scrolls downwards see lastly element in scroll bar. please share pointers.
thanks, pavan.
the scrollbar
fires selectionevent
when changed. listening event , comparing scrollbar position + thumb size maximum size should able tell when scrolled end.
final scrollbar scrollbar = scrolledcomposite.gethorizontalbar(); scrollbar.addselectionlistener( new selectionadapter() { public void widgetselected( selectionevent event ) { if( scrollbar.getselection() + scrollbar.getthumb() == scrollbar.getmaximum() ) { // spawn thread fetch farther info } } } );
you want refine status new info fetched before end of scrollbar reached, e.g.
if( scrollbar.getselection() + scrollbar.getthumb() > scrollbar.getmaximum() - scrolledcomposite.getclientarea().y ) { ... }
java swt
Comments
Post a Comment