Re: How come the ScrollEvent is never fired in this code?
Ok I got it, Thank you very much Jens. One question though, I wanted to make an infinite loop panel, is this the way to do it, how can I do without having the scroll bars, I know I can hide them in CSS but this would stop the scrolling event from firing. You don't have to answer me in detail I just need a general idea if you have the time. Cheers and thanks again. On Wednesday, June 19, 2013 2:58:39 AM UTC+3, Jens wrote: Your ScrollPanel never needs to scroll if it really has a height of 1200px but only contains such a short text. Also ScrollPanel extends SimplePanel so it can only have exactly one child widget. That means if onScroll() executes you will see an exception because you are trying to add a second child to ScrollPanel. What you want is: ScrollPanel (height 1200px) --- FlowPanel - child 1 (should be taller than 1200px so ScrollPanel can actually scroll it) - child 2 -- J. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
How come the ScrollEvent is never fired in this code?
I'm playing around with some code, but I couldn't figure out how come the ScrollEvent is never fired, I put a breakpoint on onScroll and it never breaks! Here is the code: public class InfiniteScrollPanel implements ScrollHandler { String text = Lorem ipsum dolor sit amet, consectetuer...; ScrollPanel panel; String height = 1200px; String width = 200px; public InfiniteScrollPanel() { panel = new ScrollPanel(new HTML(text)); panel.setSize(width, height); panel.addScrollHandler(this); panel.getElement().getStyle().setBackgroundColor(rgb(216, 216, 216)); } @Override public void onScroll(ScrollEvent event) { if (panel.getVerticalScrollPosition() == 1100) { panel.add(new HTML(text)); } } } Then I add it like this: InfiniteScrollPanel demo = new InfiniteScrollPanel(); RootPanel.get().add(demo.panel); Any ideas? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Re: How come the ScrollEvent is never fired in this code?
Your ScrollPanel never needs to scroll if it really has a height of 1200px but only contains such a short text. Also ScrollPanel extends SimplePanel so it can only have exactly one child widget. That means if onScroll() executes you will see an exception because you are trying to add a second child to ScrollPanel. What you want is: ScrollPanel (height 1200px) --- FlowPanel - child 1 (should be taller than 1200px so ScrollPanel can actually scroll it) - child 2 -- J. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.