PDA

View Full Version : Can't get scroll event to trigger.



alexmat
12 Aug 2009, 11:26 PM
I can't figure out how to trigger an action when the user scrolls a content panel:



ContentPanel panel = new ContentPanel();
panel.setFrame(true);
panel.setHeading("Paging Grid");
panel.setLayout(new FitLayout());
panel.add(grid);
panel.setSize(300, 350);
panel.addScrollListener(new ScrollListener() {

@Override
public void widgetScrolled(ComponentEvent ce) {
label.setText("here");
}

});


Any ideas?

sven
12 Aug 2009, 11:28 PM
A fitlayout is never scrolling. So you will never have a scrollevent there.

alexmat
12 Aug 2009, 11:37 PM
Ah, I thought it was something along those lines. Which layout would fire a scroll event while still wrapping a grid the way fit layout does (with proper scrolling)?

sven
12 Aug 2009, 11:38 PM
None.

A fitlayout sizes your component in that way, so that NO scrollbars appear. So there is nothing to scroll.

alexmat
12 Aug 2009, 11:46 PM
Understood, thanks for the help.