To let a user do scrolling, you have to use a scrollpanel with any
widget with a size bigger than the parent scrollpanel.

I use a 'personalized' ScrollPanel with touch support
(TouchScrollPanel, at the end of this mail). That panel must fit the
mobile screen. Then, inside that panel, you have to insert any widget,
with the size desired. If that widget is bigger than the scrollPanel,
then you will be able to scroll.

GWT 2.3 already let the user to do vertical and horizontal scroll with
touch and mouse events. With GWT 2.2, you will have to do horizontal
scroll manually with touch events (detect onTouchStart,onTouchMove and
onTouchEnd):

        void onTouchStart(TouchStartEvent event) {
                startPoint =  event.getChangedTouches().get(0).getClientX();
                startScroll=scrollPanel.getHorizontalScrollPosition();
        }

        void onTouchMove(TouchMoveEvent event) {
                int change = (startPoint-
event.getChangedTouches().get(0).getClientX());
                scrollPanel.setHorizontalScrollPosition(startScroll+change);
                event.preventDefault();
        }

        void onTouchEnd(TouchEndEvent event) {
                startPoint=0;
                startScroll = 0;
      }


public class TouchableScrollPanel extends ScrollPanel implements
HasAllTouchHandlers {
        @Override
        public HandlerRegistration addTouchStartHandler(TouchStartHandler
handler) {
                return addDomHandler(handler, TouchStartEvent.getType());
        }
        @Override
        public HandlerRegistration addTouchMoveHandler(TouchMoveHandler
handler) {
                return addDomHandler(handler, TouchMoveEvent.getType());
        }
        @Override
        public HandlerRegistration addTouchEndHandler(TouchEndHandler
handler) {
                return addDomHandler(handler, TouchEndEvent.getType());
        }
        @Override
        public HandlerRegistration addTouchCancelHandler(TouchCancelHandler
handler) {
                return addDomHandler(handler, TouchCancelEvent.getType());
        }
}

On Aug 7, 1:17 am, macagain <rgk...@gmail.com> wrote:
> What's the best or right way to do gwt apps that scroll properly on the
> iPad?  I.e. apps that are bigger than the browser window.  Scrollpanel does
> seem to work either.
>
> I've tried some of the touch scroll panel widgets floating around, but they
> don't show the scroll bars, which of course confuses users.
>
> i've seen the gwt wiki on gwt/iphone, but that dates from 1.4 and the
> original iphone.  Anyone know of a better guide?
>
> Anyone done a gwt app for ipad?  would love to hear your experiences.
>
> -r

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to