Hi! I am struggling with handling touch events in Codename One and I wonder if anyone has faced the same problem before.
Basically, I have a Container with vertical box layout that is scrollable in y-direction and it is filled with containers with horizontal box layout. The inner containers override pointer functions (pointerPressed(int x, int y), pointerDragged(int x, int y) and pointerReleased(int x, int y)) to enable custom flick gestures. And this makes the parent container not scrollable any more. Is there a way to keep both parent and children respond to touch events?
See code below for a simpler demo of this problem. When inner containers are set to scrollableX, the parent container is no longer scrollableY.
Form test = new Form("test");
Container c = new Container(new BoxLayout(BoxLayout.Y_AXIS));
c.setScrollableY(true);
test.addComponent(c);
for (int i = 0; i <= 5; i++) {
Container c1 = new Container(new BoxLayout(BoxLayout.X_AXIS));
c1.getUnselectedStyle().setBorder(Border.getDefaultBorder());
c1.setPreferredSize(new Dimension(Display.getInstance().getDisplayWidth(), 100));
c1.setScrollableX(true);
c1.addComponent(new Button("Button " + i));
Label l = new Label("Label " + i);
l.setPreferredW(Display.getInstance().getDisplayWidth());
c1.addComponent(l);
c.addComponent(c1);
}
test.show();
Thanks!